package bencode

  1. Overview
  2. Docs

Module Bencode_token.DecodeSource

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

    more input, for non blocking-IO

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

Input will have to provided by hand

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

Feed a substring to the decoder

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

Next token, or another result

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

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

Sourceval to_list : t -> token list option

List of tokens that can be read without starvation or error

OCaml

Innovation. Community. Security.