package bencode

  1. Overview
  2. Docs
type t
type result =
  1. | Next of token
  2. | End
  3. | Error of string
  4. | Await
    (*

    more input, for non blocking-IO

    *)
val of_string : string -> t
val of_bytes : Bytes.t -> t
val of_slice : string -> int -> int -> t
val of_bytes_slice : Bytes.t -> int -> int -> t
val of_chan : in_channel -> t
val manual : unit -> t

Input will have to provided by hand

val feed : t -> string -> int -> int -> unit

Feed a substring to the decoder

val feed_bytes : t -> Bytes.t -> int -> int -> unit
val next : t -> result

Next token, or another result

val iter : t -> (token -> unit) -> unit

Iterate on tokens that can be read without errors nor starvation.

val to_list : t -> token list option

List of tokens that can be read without starvation or error

OCaml

Innovation. Community. Security.