package containers
Module CCByte_sliceSource
A simple byte slice.
Source
type t = {bs : bytes;(*The bytes, potentially shared between many slices
*)mutable off : int;(*Offset in
*)bsmutable len : int;(*Length of the slice. Valid indices are
*)bs[off]…bs[off+len-1], inclusive.
}Simple printer (summary, doesn't show the content)
unsafe_of_string s makes a slice from a string. This is unsafe because mutating the bytes is forbidden (just like with Bytes.unsafe_of_string
get sl i gets the i-th byte of the slice. Same as sl.bs.[sl.off + i].
consume sl n moves the offset forward by n bytes, and reduces len by n bytes.