123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134(** See {{!Core.Iobuf}[Iobuf]} for documentation. *)open!Import(** [no_seek] and [seek] are phantom types used in a similar manner to [read] and
[read_write]. *)typeno_seek[@@derivingsexp_of](** Like [read]. *)typeseek=privateno_seek[@@derivingsexp_of](** Like [read_write]. *)(** Collections of access functions. These abstract over [Iobuf.Consume], [Iobuf.Fill],
[Iobuf.Peek], and [Iobuf.Poke].
Make all labeled arguments mandatory in [string] and [bigstring] to avoid accidental
allocation in, e.g., [Iobuf.Poke.string]. For convenience, [stringo] and [bigstringo]
are available by analogy between [blit] and [blito].
[_trunc] functions silently truncate values that don't fit. For example,
[Iobuf.Unsafe.Poke.int8 128] effectively writes -128. *)moduletypeAccessors_common=sig(** [('d, 'w) Iobuf.t] accessor function manipulating ['a], either writing it to the
iobuf or reading it from the iobuf. *)type('a,'d,'w)tconstraint'd=[>read]type'abin_protvalchar:(char,'d,'w)tvalint64_t_be:(Int64.t,'d,'w)tvalint64_t_le:(Int64.t,'d,'w)tvalhead_padded_fixed_string:padding:char->len:int->(string,'d,'w)tvaltail_padded_fixed_string:padding:char->len:int->(string,'d,'w)tvalstring:str_pos:int->len:int->(string,'d,'w)tvalbytes:str_pos:int->len:int->(Bytes.t,'d,'w)tvalbigstring:str_pos:int->len:int->(Bigstring.t,'d,'w)tvalstringo:?str_pos:int->?len:int->(string,'d,'w)tvalbyteso:?str_pos:int->?len:int->(Bytes.t,'d,'w)tvalbigstringo:?str_pos:int->?len:int->(Bigstring.t,'d,'w)tvalbin_prot:'abin_prot->('a,'d,'w)tendmoduletypeAccessors_read=sigincludeAccessors_commonvalint8:(int,'d,'w)tvalint16_be:(int,'d,'w)tvalint16_le:(int,'d,'w)tvalint32_be:(int,'d,'w)tvalint32_le:(int,'d,'w)tvalint64_be_exn:(int,'d,'w)tvalint64_le_exn:(int,'d,'w)tvalint64_be_trunc:(int,'d,'w)tvalint64_le_trunc:(int,'d,'w)tvaluint8:(int,'d,'w)tvaluint16_be:(int,'d,'w)tvaluint16_le:(int,'d,'w)tvaluint32_be:(int,'d,'w)tvaluint32_le:(int,'d,'w)tvaluint64_be_exn:(int,'d,'w)tvaluint64_le_exn:(int,'d,'w)tendmoduletypeAccessors_write=sigincludeAccessors_commonvalint8_trunc:(int,'d,'w)tvalint16_be_trunc:(int,'d,'w)tvalint16_le_trunc:(int,'d,'w)tvalint32_be_trunc:(int,'d,'w)tvalint32_le_trunc:(int,'d,'w)tvalint64_be:(int,'d,'w)tvalint64_le:(int,'d,'w)tvaluint8_trunc:(int,'d,'w)tvaluint16_be_trunc:(int,'d,'w)tvaluint16_le_trunc:(int,'d,'w)tvaluint32_be_trunc:(int,'d,'w)tvaluint32_le_trunc:(int,'d,'w)tvaluint64_be_trunc:(int,'d,'w)tvaluint64_le_trunc:(int,'d,'w)tend(** An iobuf window bound, either upper or lower. You can't see its int value, but you
can save and restore it. *)moduletypeBound=sigtype('d,'w)iobuftypet=privateint(*_ performance hack: avoid the write barrier *)[@@derivingcompare,sexp_of]valwindow:(_,_)iobuf->tvallimit:(_,_)iobuf->tvalrestore:t->(_,seek)iobuf->unitend(** The [src_pos] argument of {!Core_kernel.Blit.blit} doesn't make sense here. *)type('src,'dst)consuming_blit=src:'src->dst:'dst->dst_pos:int->len:int->unittype('src,'dst)consuming_blito=src:'src->?src_len:int(** Default is [Iobuf.length src]. *)->dst:'dst->?dst_pos:int(** Default is [0]. *)->unit->unitmoduletypeConsuming_blit=sigtypesrctypedstvalblito:(src,dst)consuming_blitovalblit:(src,dst)consuming_blitvalunsafe_blit:(src,dst)consuming_blit(** [subo] defaults to using [Iobuf.length src] *)valsubo:?len:int->src->dstvalsub:src->len:int->dstendmoduletypeCompound_hexdump=sigtype('rw,'seek)tmoduleHexdump:sigtypenonrec('rw,'seek)t=('rw,'seek)t[@@derivingsexp_of]valto_string_hum:?max_lines:int->(_,_)t->stringvalto_sequence:?max_lines:int->(_,_)t->stringSequence.tendend(*_ For use in iobuf.mli -- can't be added to Std_internal due to dependencies. This
reduces noise in iobuf.mli by allowing the use of [Unix] rather than [Core_unix]
throughout. *)moduleUnix=Core_unix