mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
add CCByte_buffer.to_slice
This commit is contained in:
parent
c29083c216
commit
f5aa4de6e7
2 changed files with 5 additions and 0 deletions
|
|
@ -89,6 +89,7 @@ let[@inline] contents self = Bytes.sub_string self.bs 0 self.len
|
|||
let[@inline] contents_bytes self = Bytes.sub self.bs 0 self.len
|
||||
let[@inline] append_iter self i = i (add_char self)
|
||||
let[@inline] append_seq self seq = Seq.iter (add_char self) seq
|
||||
let[@inline] to_slice self = CCByte_slice.create ~len:self.len self.bs
|
||||
|
||||
let fold_left f acc self =
|
||||
let { bs; len } = self in
|
||||
|
|
|
|||
|
|
@ -65,6 +65,10 @@ val unsafe_get : t -> int -> char
|
|||
val set : t -> int -> char -> unit
|
||||
val unsafe_set : t -> int -> char -> unit
|
||||
|
||||
val to_slice : t -> CCByte_slice.t
|
||||
(** [to_slice buf] returns a slice of the current content.
|
||||
The slice shares the same byte array as [buf] (until [buf] is resized). *)
|
||||
|
||||
val contents : t -> string
|
||||
(** Copy the internal data to a string. Allocates. *)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue