Hcs.Codec.String_codec
hcs · API reference
UTF-8/text codec.
Use this for simple string bodies where application code provides conversion to and from strings.
type 'a encoder = 'a -> stringEncoder for values of type 'a.
type 'a decoder = string -> ('a, string) resultDecoder for values of type 'a.
val content_type : stringHTTP Content-Type emitted for encoded values.
val encode : 'a encoder -> 'a -> (Cstruct.t, string) resultEncode a value to bytes.
val decode : 'a decoder -> Cstruct.t -> ('a, string) resultDecode bytes into a value.
val encode_stream : 'a encoder -> 'a -> Cstruct.t Seq.t optionOptional streaming encoder for large values. Return None when unsupported.
val decode_stream : 'a decoder -> Cstruct.t Seq.t -> ('a, string) result optionOptional streaming decoder for large values. Return None when unsupported.