Packages

o

kantan.codecs.strings

StringDecoder

object StringDecoder extends DecoderCompanion[String, DecodeError, codecs.type] with PlatformSpecificDecoders

Provides instance creation and summing methods for StringDecoder.

Default StringDecoder instances are provided in codecs.

Source
StringDecoder.scala
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. StringDecoder
  2. PlatformSpecificDecoders
  3. DecoderCompanion
  4. Serializable
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. macro def apply[D](implicit ev: Decoder[String, D, DecodeError, codecs.type]): Decoder[String, D, DecodeError, codecs.type]

    Summons an implicit instance of Decoder if one is found, fails compilation otherwise.

    Summons an implicit instance of Decoder if one is found, fails compilation otherwise.

    This is a slightly faster, less verbose version of implicitly.

    Definition Classes
    DecoderCompanion
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  7. def dateDecoder(format: DateFormat): StringDecoder[Date]

    Creates a StringDecoder instance for java.util.Date.

    Creates a StringDecoder instance for java.util.Date.

    Definition Classes
    PlatformSpecificDecoders
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  11. def from[D](f: (String) => Either[DecodeError, D]): Decoder[String, D, DecodeError, codecs.type]

    Creates a new Decoder instance from the specified function.

    Creates a new Decoder instance from the specified function.

    Definition Classes
    DecoderCompanion
    Annotations
    @inline()
  12. def fromPartial[D](f: PartialFunction[String, Either[DecodeError, D]])(implicit t: IsError[DecodeError]): Decoder[String, D, DecodeError, codecs.type]
    Definition Classes
    DecoderCompanion
    Annotations
    @SuppressWarnings()
  13. def fromUnsafe[D](f: (String) => D)(implicit t: IsError[DecodeError]): Decoder[String, D, DecodeError, codecs.type]

    Creates a new Decoder instance from the specified function.

    Creates a new Decoder instance from the specified function.

    This method turns the specified function safe. The error message might end up being a bit generic though - use from if you want to deal with errors explicitly.

    Definition Classes
    DecoderCompanion
    Annotations
    @inline()
  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. def makeSafe[D](typeName: String)(f: (String) => D): (String) => StringResult[D]

    Creates a safe decoding function from the specified unsafe one.

    Creates a safe decoding function from the specified unsafe one.

    This method expects the specified decoding function to be able to fail by throwing exceptions. These will be caught and wrapped in DecodeError.

    This is typically used in conjunction with [StringDecoder.from], when creating instances for types that are not isomorphic to String.

    D

    decoded type.

    typeName

    name of the decoded type (used in error messages).

    f

    decoding function.

    Example:
    1. scala> val decoder = StringDecoder.makeSafe("Int")(_.toInt)
      
      scala> decoder("1")
      res1: StringResult[Int] = Right(1)
      
      scala> decoder("foobar")
      res2: StringResult[Int] = Left(DecodeError: 'foobar' is not a valid Int)
  18. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  19. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  21. def oneOf[D](ds: Decoder[String, D, DecodeError, codecs.type]*)(implicit i: IsError[DecodeError]): Decoder[String, D, DecodeError, codecs.type]

    Creates a new Decoder instance from the specified alternatives.

    Creates a new Decoder instance from the specified alternatives.

    When decoding, each of the specified decoders will be attempted. The result will be the first success if found, or the last failure otherwise.

    Definition Classes
    DecoderCompanion
    Annotations
    @inline()
  22. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  23. def toString(): String
    Definition Classes
    AnyRef → Any
  24. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  26. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from DecoderCompanion[String, DecodeError, codecs.type]

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped