package iostream

  1. Overview
  2. Docs

Byte slice or buffer.

type t = Iostream_types.Slice.t = {
  1. bytes : bytes;
    (*

    Bytes

    *)
  2. mutable off : int;
    (*

    Offset in bytes

    *)
  3. mutable len : int;
    (*

    Length of the slice. Empty slice has len=0

    *)
}

A slice of bytes. The valid bytes in the slice are bytes[off], bytes[off+1], …, bytes[off+len-1] (i.e len bytes starting at offset off).

val empty : t
val create : int -> t
val of_bytes : bytes -> t
val bytes : t -> bytes
val off : t -> int
val len : t -> int
val consume : t -> int -> unit

Consume the first n bytes from the slice, making it n bytes shorter. This modifies the slice in place.

val find_index_exn : t -> char -> int

find index of c in slice, or raise Not_found

OCaml

Innovation. Community. Security.