mirror of
https://github.com/c-cube/iter.git
synced 2025-12-05 19:00:31 -05:00
change name of IO functions (keep compat)
This commit is contained in:
parent
0de04d0eb8
commit
22705b24f0
4 changed files with 17 additions and 16 deletions
1
_tags
1
_tags
|
|
@ -28,4 +28,3 @@
|
|||
<bench/*.ml{,i}>: use_sequence
|
||||
# OASIS_STOP
|
||||
true: bin_annot
|
||||
true: safe_string
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
(** {1 Interface and Helpers for bigarrays}
|
||||
|
||||
@since NEXT_RELEASE *)
|
||||
@since 0.5.4 *)
|
||||
|
||||
val of_bigarray : ('a, _, _) Bigarray.Array1.t -> 'a Sequence.t
|
||||
(** Iterate on the elements of a 1-D array *)
|
||||
|
|
|
|||
16
sequence.ml
16
sequence.ml
|
|
@ -770,7 +770,7 @@ module IO = struct
|
|||
close_in_noerr ic;
|
||||
raise e
|
||||
|
||||
let write_to ?(mode=0o644) ?(flags=[Open_creat;Open_wronly]) filename seq =
|
||||
let write_bytes_to ?(mode=0o644) ?(flags=[Open_creat;Open_wronly]) filename seq =
|
||||
let oc = open_out_gen flags mode filename in
|
||||
try
|
||||
seq (fun s -> output oc s 0 (Bytes.length s));
|
||||
|
|
@ -779,13 +779,13 @@ module IO = struct
|
|||
close_out oc;
|
||||
raise e
|
||||
|
||||
let write_str_to ?mode ?flags filename seq =
|
||||
write_to ?mode ?flags filename (map Bytes.unsafe_of_string seq)
|
||||
let write_to ?mode ?flags filename seq =
|
||||
write_bytes_to ?mode ?flags filename (map Bytes.unsafe_of_string seq)
|
||||
|
||||
let write_bytes_lines ?mode ?flags filename seq =
|
||||
let ret = Bytes.unsafe_of_string "\n" in
|
||||
write_bytes_to ?mode ?flags filename (snoc (intersperse ret seq) ret)
|
||||
|
||||
let write_lines ?mode ?flags filename seq =
|
||||
let ret = Bytes.unsafe_of_string "\n" in
|
||||
write_to ?mode ?flags filename (snoc (intersperse ret seq) ret)
|
||||
|
||||
let write_str_lines ?mode ?flags filename seq =
|
||||
write_lines ?mode ?flags filename (map Bytes.unsafe_of_string seq)
|
||||
write_bytes_lines ?mode ?flags filename (map Bytes.unsafe_of_string seq)
|
||||
end
|
||||
|
|
|
|||
14
sequence.mli
14
sequence.mli
|
|
@ -586,19 +586,21 @@ module IO : sig
|
|||
different iterations might return different results *)
|
||||
|
||||
val write_to : ?mode:int -> ?flags:open_flag list ->
|
||||
string -> Bytes.t t -> unit
|
||||
string -> string t -> unit
|
||||
(** [write_to filename seq] writes all strings from [seq] into the given
|
||||
file. It takes care of opening and closing the file.
|
||||
@param mode default [0o644]
|
||||
@param flags used by [open_out_gen]. Default: [[Open_creat;Open_wronly]]. *)
|
||||
|
||||
val write_str_to : ?mode:int -> ?flags:open_flag list ->
|
||||
string -> string t -> unit
|
||||
val write_bytes_to : ?mode:int -> ?flags:open_flag list ->
|
||||
string -> Bytes.t t -> unit
|
||||
(** @since 0.5.4 *)
|
||||
|
||||
val write_lines : ?mode:int -> ?flags:open_flag list ->
|
||||
string -> Bytes.t t -> unit
|
||||
string -> string t -> unit
|
||||
(** Same as {!write_to}, but intercales ['\n'] between each string *)
|
||||
|
||||
val write_str_lines : ?mode:int -> ?flags:open_flag list ->
|
||||
string -> string t -> unit
|
||||
val write_bytes_lines : ?mode:int -> ?flags:open_flag list ->
|
||||
string -> Bytes.t t -> unit
|
||||
(** @since 0.5.4 *)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue