RichTextCodec

zio.http.codec.RichTextCodec
See theRichTextCodec companion object
sealed abstract class RichTextCodec[A]

A RichTextCodec is a more compositional version of TextCodec, which has similar power to traditional parser combinators / pretty printers. Although slower than the simpler text codecs, they can be utilized to parse structured information in HTTP headers, which in turn allows generating much better error messages and documentation than otherwise possible.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

final def <~(that: => RichTextCodec[Unit]): RichTextCodec[A]

Returns a new codec that is the sequential composition of this codec and the specified codec, but which only produces the value of this codec.

Returns a new codec that is the sequential composition of this codec and the specified codec, but which only produces the value of this codec.

Attributes

final def ?!(label: String): Tagged[A]

Tags the codec with a label used in the documentation. The label will be used but not explained

Tags the codec with a label used in the documentation. The label will be used but not explained

Attributes

final def ??(label: String): Tagged[A]

Tags the codec with a label used in the documentation

Tags the codec with a label used in the documentation

Attributes

final def as[B](b: => B)(implicit ev: A =:= Unit): RichTextCodec[B]

Tranforms this constant unit codec to a constant codec of another type.

Tranforms this constant unit codec to a constant codec of another type.

Attributes

final def asType[B](implicit ev: A =:= B): RichTextCodec[B]
final def collectOrFail(failure: String)(pf: PartialFunction[A, A]): RichTextCodec[A]
final def const(canonical: A): RichTextCodec[Unit]

Converts this codec of A into a codec of Unit by specifying a canonical value to use when an HTTP client needs to generate a value for this codec.

Converts this codec of A into a codec of Unit by specifying a canonical value to use when an HTTP client needs to generate a value for this codec.

Attributes

final def decode(value: CharSequence): Either[String, A]
final def describe: Doc

Constructs documentation for this rich text codec.

Constructs documentation for this rich text codec.

Attributes

final def encode(value: A): Either[String, String]

Encodes a value into a string, or if this is not possible, fails with an error message.

Encodes a value into a string, or if this is not possible, fails with an error message.

Attributes

final def merge[B](implicit ev: A <:< Either[B, B]): RichTextCodec[B]

This method is Right biased merge

This method is Right biased merge

Attributes

final def optional(default: A): RichTextCodec[Option[A]]
final def string(implicit ev: A =:= Chunk[Char]): RichTextCodec[String]
final def tagged(label: String): Tagged[A]
final def taggedUnexplained(label: String): Tagged[A]
final def transform[B](f: A => B)(g: B => A): RichTextCodec[B]
final def transformOrFail[B](f: A => Either[String, B])(g: B => Either[String, A]): RichTextCodec[B]
final def transformOrFailLeft[B](f: A => Either[String, B])(g: B => A): RichTextCodec[B]
final def transformOrFailRight[B](f: A => B)(g: B => Either[String, A]): RichTextCodec[B]
final def validate(failure: String)(p: A => Boolean): RichTextCodec[A]

Attempts to validate a decoded value, or fails using the specified failure message.

Attempts to validate a decoded value, or fails using the specified failure message.

Attributes

final def withError(errorMessage: String): RichTextCodec[A]
final def |[B](that: => RichTextCodec[B]): RichTextCodec[Either[A, B]]

Returns a new codec that is the fallback composition of this codec and the specified codec, preferring this codec, but falling back to the specified codec in the event of failure.

Returns a new codec that is the fallback composition of this codec and the specified codec, preferring this codec, but falling back to the specified codec in the event of failure.

Attributes

final def ~[B](that: => RichTextCodec[B])(implicit combiner: Combiner[A, B]): RichTextCodec[Out]

Returns a new codec that is the sequential composition of this codec and the specified codec, producing the values of both as a tuple.

Returns a new codec that is the sequential composition of this codec and the specified codec, producing the values of both as a tuple.

Attributes

final def ~>[B](that: => RichTextCodec[B])(implicit ev: A =:= Unit): RichTextCodec[B]

Returns a new codec that is the sequential composition of this codec and the specified codec, but which only produces the value of that codec.

Returns a new codec that is the sequential composition of this codec and the specified codec, but which only produces the value of that codec.

Attributes

Concrete fields

final lazy val repeat: RichTextCodec[Chunk[A]]