package containers
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
A modular, clean and powerful extension of the OCaml standard library
Install
dune-project
Dependency
Authors
Maintainers
Sources
containers-3.18.tbz
sha256=52eeff91ce42b52305e6aaa8a58b88ce8f0a5a984199e59ca7e2fd9ebabe61d7
sha512=dc7337e6cbc9850542c7c9228d3bcb4e4add57a55e2a2992f21fb4761b3e10a68ef1d57ca37a7f5b303fc875fe3df5ecb69dbf2930bfcd1561ce03f7ae83e24b
doc/src/containers/CCByte_slice.ml.html
Source file CCByte_slice.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42type t = { bs: bytes; mutable off: int; mutable len: int; } let show self = Printf.sprintf "<slice len=%d>" self.len let pp out self = Format.pp_print_string out (show self) let create ?(off = 0) ?len bs = let len = match len with | None -> Bytes.length bs - off | Some n -> if n < 0 || off + n > Bytes.length bs then invalid_arg "Bslice: invalid length"; n in { bs; off; len } let[@inline] unsafe_of_string ?off ?len s = create ?off ?len (Bytes.unsafe_of_string s) let[@inline] len self = self.len let[@inline] contents self = Bytes.sub_string self.bs self.off self.len let[@inline] get self i : char = if i >= self.len then invalid_arg "Bslice: out of bound access"; Bytes.unsafe_get self.bs (self.off + i) let[@inline] set self i c : unit = if i >= self.len then invalid_arg "Bslice: out of bound access"; Bytes.unsafe_set self.bs (self.off + i) c let sub self off len = if off + len > self.len then invalid_arg "Bslice: invalid length"; { bs = self.bs; off = self.off + off; len } let[@inline] consume self n : unit = if n > self.len then invalid_arg "Bslice: consuming too many bytes"; self.off <- self.off + n; self.len <- self.len - n
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>