package slice

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

Module Slice_bstrSource

Sourceval make : ?off:int -> ?len:int -> Bstr.t -> t
Sourceval empty : t

empty is an empty slice.

Sourceval length : t -> int

length slice is the number of bytes in slice.

Sourceval get : t -> int -> char

get slice i is the byte of slice' at index i.

Sourceval get_int8 : t -> int -> int

get_int8 slice i is slice's signed 8-bit integer starting at byte index i.

Sourceval get_uint8 : t -> int -> int

get_uint8 slice i is slice's unsigned 8-bit integer starting at byte index i.

Sourceval get_uint16_ne : t -> int -> int

get_int16_ne slice i is slice's native-endian unsigned 16-bit integer starting at byte index i.

Sourceval get_uint16_le : t -> int -> int

get_int16_le slice i is slice's little-endian unsigned 16-bit integer starting at byte index i.

Sourceval get_uint16_be : t -> int -> int

get_int16_be slice i is slice's big-endian unsigned 16-bit integer starting at byte index i.

Sourceval get_int16_ne : t -> int -> int

get_int16_ne slice i is slice's native-endian signed 16-bit integer starting at byte index i.

Sourceval get_int16_le : t -> int -> int

get_int16_le slice i is slice's little-endian signed 16-bit integer starting at byte index i.

Sourceval get_int16_be : t -> int -> int

get_int16_be slice i is slice's big-endian signed 16-bit integer starting at byte index i.

Sourceval get_int32_ne : t -> int -> int32

get_int32_ne slice i is slice's native-endian 32-bit integer starting at byte index i.

Sourceval get_int32_le : t -> int -> int32

get_int32_le slice i is slice's little-endian 32-bit integer starting at byte index i.

Sourceval get_int32_be : t -> int -> int32

get_int32_be slice i is slice's big-endian 32-bit integer starting at byte index i.

Sourceval get_int64_ne : t -> int -> int64

get_int64_ne slice i is slice's native-endian 64-bit integer starting at byte index i.

Sourceval get_int64_le : t -> int -> int64

get_int64_le slice i is slice's little-endian 64-bit integer starting at byte index i.

Sourceval get_int64_be : t -> int -> int64

get_int64_be slice i is slice's big-endian 64-bit integer starting at byte index i.

Sourceval set : t -> int -> char -> unit

set t i chr modifies t in place, replacing the byte at index i with chr.

Sourceval set_int8 : t -> int -> int -> unit

set_int8 t i v sets t's signed 8-bit integer starting at byte index i to v.

Sourceval set_uint8 : t -> int -> int -> unit

set_uint8 t i v sets t's unsigned 8-bit integer starting at byte index i to v.

Sourceval set_uint16_ne : t -> int -> int -> unit

set_uint16_ne t i v sets t's native-endian unsigned 16-bit integer starting at byte index i to v.

Sourceval set_uint16_le : t -> int -> int -> unit

set_uint16_le t i v sets t's little-endian unsigned 16-bit integer starting at byte index i to v.

Sourceval set_uint16_be : t -> int -> int -> unit

set_uint16_le t i v sets t's big-endian unsigned 16-bit integer starting at byte index i to v.

Sourceval set_int16_ne : t -> int -> int -> unit

set_uint16_ne t i v sets t's native-endian signed 16-bit integer starting at byte index i to v.

Sourceval set_int16_le : t -> int -> int -> unit

set_uint16_le t i v sets t's little-endian signed 16-bit integer starting at byte index i to v.

Sourceval set_int16_be : t -> int -> int -> unit

set_uint16_le t i v sets t's big-endian signed 16-bit integer starting at byte index i to v.

Sourceval set_int32_ne : t -> int -> int32 -> unit

set_int32_ne t i v sets t's native-endian 32-bit integer starting at byte index i to v.

Sourceval set_int32_le : t -> int -> int32 -> unit

set_int32_ne t i v sets t's little-endian 32-bit integer starting at byte index i to v.

Sourceval set_int32_be : t -> int -> int32 -> unit

set_int32_ne t i v sets t's big-endian 32-bit integer starting at byte index i to v.

Sourceval set_int64_ne : t -> int -> int64 -> unit

set_int32_ne t i v sets t's native-endian 64-bit integer starting at byte index i to v.

Sourceval set_int64_le : t -> int -> int64 -> unit

set_int32_ne t i v sets t's little-endian 64-bit integer starting at byte index i to v.

Sourceval set_int64_be : t -> int -> int64 -> unit

set_int32_ne t i v sets t's big-endian 64-bit integer starting at byte index i to v.

Sourceval blit : t -> t -> unit

blit src dst copies all bytes of src into dst.

Sourceval fill : t -> ?off:int -> ?len:int -> char -> unit

fill t off len chr modifies t in place, replacing len characters with chr, starting at off.

Sourceval sub : t -> off:int -> len:int -> t

sub slice ~off ~len does not allocate a new bigstring, but instead returns a new view into t.buf starting at off, and with length len.

Note that this does not allocate a new buffer, but instead shares the buffer of t.buf with the newly-returned slice.

Sourceval shift : t -> int -> t

shift slice n is sub slice n (length slice - n) (see sub for more details).

Sourceval sub_string : t -> off:int -> len:int -> string

sub_string slice ~off ~len returns a string of length len containing the bytes of slice starting at off.

Sourceval to_string : t -> string

to_string slice is equivalent to sub_string slice ~off:0 ~len:(length slice).

Sourceval is_empty : t -> bool

is_empty bstr is length bstr = 0.

Sourceval of_string : string -> t

of_string str returns a new t that contains the contents of the given string str.

Sourceval string : ?off:int -> ?len:int -> string -> t

string ~off ~len str is the sub-buffer of str that starts at position off (defaults to 0) and stops at position off + len (defaults to String.length str). str is fully-replaced by a fresh allocated t.

Sourceval overlap : t -> t -> (int * int * int) option

overlap x y returns the size (in bytes) of what is physically common between x and y, as well as the position of y in x and the position of x in y.

OCaml

Innovation. Community. Security.