package slice

  1. Overview
  2. Docs
A Slice type for bigstrings and bytes

Install

Dune Dependency

Authors

Maintainers

Sources

bstr-0.0.1.tbz
sha256=05701fb60e9f9b419cc2d3989cf58c60eba1b5e7a5d08fba7f9d92f29ea3a46e
sha512=2199910457d8dedeefe3ffa3e4ef7a4f0845bb66459bcf3951d6197ec5f32a0c49c29874341d7fc4ee026c82a95a0c8aaaea084840b10530f6c00a6120960174

doc/slice.bytes/Slice_bytes/index.html

Module Slice_bytesSource

Sourcetype t = bytes Slice.t
Sourceval make : ?off:int -> ?len:int -> bytes -> 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 bytes, 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.