package regular

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Read typeclass.

A class of readable values. It is rarely needed to use this module directly, as it is used for implementing new readers, i.e., new protocols. If you are looking for the IO functions available for a type, then look at the Data.S interface.

type 'a t = 'a reader

readable

val create : ?of_channel:(Core_kernel.Std.In_channel.t -> 'a) -> ?of_lexbuf:(lexbuf -> 'a) -> ?of_scanbuf:(scanbuf -> 'a) -> ?of_bigstring:(Core_kernel.Std.bigstring -> 'a) -> ?of_bytes:(bytes -> 'a) -> unit -> 'a t

A minimal complete definition is any method except of_channel (that is not sufficient).

If a class is defined only with from_bigstring or from_bytes then from_channel function will consume all input and pass it to the correspondings function.

val of_bytes : 'a t -> bytes -> 'a

of_bytes readable bytes reads a value from bytes

val of_channel : 'a t -> Core_kernel.Std.In_channel.t -> 'a

of_channel readable channel inputs a value from a channel. If of_channel function wasn't provided when readable was created, then the whole content of the In_channel.t is read into an intermediate buffer, that is later read. Any leftover bytes are discarded.

val of_bigstring : 'a t -> Core_kernel.Std.bigstring -> 'a

of_bigstring readable buf deserializes a readable value from the bigstring.

OCaml

Innovation. Community. Security.