package bencode

  1. Overview
  2. Docs
type t
val create : Bencode_token.Decode.t -> t
val of_string : string -> t
val of_bytes : Bytes.t -> t
val of_chan : in_channel -> t
val manual : unit -> t
type parse_result =
  1. | ParseOk of bencode
  2. | ParseError of string
  3. | ParseEnd
    (*

    end of input

    *)
  4. | ParsePartial
    (*

    Await more input

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

Provide some more input (the subtstring). Only useful for manual, non-blocking parsing.

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

Parse next value

val parse_string : string -> bencode option

Parse the string.

val parse_string_exn : string -> bencode
  • raises Failure

    if it fails to parse.

OCaml

Innovation. Community. Security.