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.17.tbz
sha256=0f70824867269c02bf01ae12206aa47a6f669d69f1954c19e68ece9f444f1cba
sha512=11de2d7b7173659e6b83c487ac116a93d4b780b86da07386e7604f8fd45f6841e93cba59dba59ed7dbf6e1bc26561202ae1d2e7238a12f588dfd557d4f2da589
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)"
>