Skip to content
Browse files

[feature] libbase: Added copy to Buf.

  • Loading branch information...
1 parent 587dd05 commit 79660b42bfa258254b2002e4910916849fca2212 @nrs135 nrs135 committed
Showing with 3 additions and 0 deletions.
  1. +2 −0 libbase/buf.ml
  2. +1 −0 libbase/buf.mli
View
2 libbase/buf.ml
@@ -34,6 +34,8 @@ let resize buf size =
buf.str <- str;
buf.i <- newlen
+let copy buf = { str=String.copy buf.str; i=buf.i }
+
let clear buf = buf.i <- 0
let reset buf = buf.str <- ""; buf.i <- 0
View
1 libbase/buf.mli
@@ -36,6 +36,7 @@ val get : buf -> int -> char
val unsafe_get : buf -> int -> char
val set : buf -> int -> char -> unit
val unsafe_set : buf -> int -> char -> unit
+val copy : buf -> buf
(** Compatibility with Buffer **)
val nth : buf -> int -> char

0 comments on commit 79660b4

Please sign in to comment.
Something went wrong with that request. Please try again.