TextCodec

zio.http.codec.TextCodec
See theTextCodec companion object
sealed trait TextCodec[A] extends PartialFunction[String, A]

A zio.http.codec.TextCodec defines a codec for a text fragment. The text fragment can be decoded into a value, or the value can be encoded into a text fragment.

Unlike parsers, text codecs operate on entire fragments. They do not consume input and leave remainders. Also unlike parsers, text codecs do not fail with error messages, but rather, simply return None if they do not succeed in decoding from a given text fragment. Finally, unlike ordinary parsers, text codecs are fully invertible, and can therefore be used in client generation.

Attributes

Companion
object
Graph
Supertypes
trait PartialFunction[String, A]
trait String => A
class Object
trait Matchable
class Any
Known subtypes
object BooleanCodec.type
class Constant
object IntCodec.type
object LongCodec.type
object StringCodec.type
object UUIDCodec.type
Show all
Self type

Members list

Value members

Abstract methods

def apply(value: String): A
def describe: String
def encode(value: A): String
def isDefinedAt(value: String): Boolean

Concrete methods

final def decode(value: String): Option[A]

Inherited methods

def andThen[C](k: PartialFunction[A, C]): PartialFunction[A, C]

Attributes

Inherited from:
PartialFunction
override def andThen[C](k: A => C): PartialFunction[A, C]

Attributes

Definition Classes
PartialFunction -> Function1
Inherited from:
PartialFunction
def applyOrElse[A1 <: String, B1 >: A](x: A1, default: A1 => B1): B1

Attributes

Inherited from:
PartialFunction
def compose[R](k: PartialFunction[R, String]): PartialFunction[R, B]

Attributes

Inherited from:
PartialFunction
def compose[A](g: A => String): A => R

Attributes

Inherited from:
Function1
def elementWise: ElementWiseExtractor[A, B]

Attributes

Inherited from:
PartialFunction
def lift: A => Option[B]

Attributes

Inherited from:
PartialFunction
def orElse[A1 <: String, B1 >: A](that: PartialFunction[A1, B1]): PartialFunction[A1, B1]

Attributes

Inherited from:
PartialFunction
def runWith[U](action: A => U): A => Boolean

Attributes

Inherited from:
PartialFunction
override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Function1 -> Any
Inherited from:
Function1
def unapply(a: String): Option[B]

Attributes

Inherited from:
PartialFunction