package rosetta

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type encoding = [
  1. | `UTF_7
  2. | Uuuu.encoding
  3. | Coin.encoding
]

The type of encoding.

val encoding_of_string : string -> encoding

encoding_of_string s converts a (case insensitive) IANA character set name to an encoding.

val encoding_to_string : encoding -> string

encoding_to_string e is a IANA character set name for e.

type 'kind decoder constraint 'kind = [< encoding ]

The type for decoders.

type src = [
  1. | `Manual
  2. | `Channel of Stdlib.in_channel
  3. | `String of string
]

The type for input sources. With a `Manual source the client must provide input with src.

type decode = [
  1. | `Await
  2. | `End
  3. | `Uchar of Stdlib.Uchar.t
  4. | `Malformed of string
]
val src : encoding decoder -> Stdlib.Bytes.t -> int -> int -> unit

src d s j l provides d with l bytes to read, starting at j in s. This byte range is read by calls to decode with d until `Await is returned. To signal the end of input call the function with l = 0.

val decoder : encoding -> src -> encoding decoder

decoder encoding src is a decoder that inputs from src.

Encoding. encoding specifies the decoded encoding scheme.

val decode : encoding decoder -> decode

decode d is:

  • `Await if d has a `Manual input source and awaits for more input. The client must use src to provide it.
  • `Uchar u if a Unicode scalar value u was decoder.
  • `End if the end of input was reached.
  • `Malformed err if d encountered an error err.

Note. Repeated invocation always eventually returns `End, even in case of errors.

val decoder_byte_count : encoding decoder -> int

decoder_byte_count d is the number of characters already decoder on d (including malformed ones). This is the last decode's and byte offset counting from beginning of the stream.

val decoder_src : encoding decoder -> src

decoder_src d is d's input source.

val decoder_kind : encoding decoder -> encoding

decoder_kind d is d's the decoded encoding scheme of d.

module String : sig ... end
OCaml

Innovation. Community. Security.