module Netstring_tstring: sig
.. end
Support module for tagged strings
type '_
tstring_kind =
GADT for encoding the string type (string/bytes/bigarray)
type 't
tstring_ops = {
|
kind : 't tstring_kind option ; |
|
length : 't -> int ; |
|
get : 't -> int -> char ; |
|
unsafe_get : 't -> int -> char ; |
|
unsafe_get3 : 't -> int -> int ; |
|
copy : 't -> 't ; |
|
string : 't -> string ; |
|
bytes : 't -> Bytes.t ; |
|
sub : 't -> int -> int -> 't ; |
|
substring : 't -> int -> int -> string ; |
|
subbytes : 't -> int -> int -> Bytes.t ; |
|
subpoly : 'u. 'u tstring_kind -> 't -> int -> int -> 'u ; |
|
blit_to_bytes : 't -> int -> Bytes.t -> int -> int -> unit ; |
|
blit_to_memory : 't -> int -> Netsys_types.memory -> int -> int -> unit ; |
|
index_from : 't -> int -> char -> int ; |
|
index_from3 : 't -> int -> int -> char -> char -> char -> int ; |
|
rindex_from : 't -> int -> char -> int ; |
|
rindex_from3 : 't -> int -> int -> char -> char -> char -> int ; |
}
Operations to call on strings
type
tstring_ops_box =
GADT for hiding the type parameter
type
tstring_box =
GADT for hiding the type parameter
type
tstring_polybox =
GADT for hiding the type parameter. Warning: This GADT does not permit you
to recover the kind of string
val string_ops : string tstring_ops
Implementation of the operations for string
val bytes_ops : Bytes.t tstring_ops
Implementation of the operations for bytes
val memory_ops : Netsys_types.memory tstring_ops
Implementation of the operations for memory
val ops_of_tstring : Netsys_types.tstring -> tstring_ops_box
Create a Tstring_ops_box
type 'a
with_fun = {
}
A polymorphic function for strings
val with_tstring : 'a with_fun -> Netsys_types.tstring -> 'a
with_tstring f ts
: Calls f.with_fun
with the right implementation of
the tstring_ops
argument
val length_tstring : Netsys_types.tstring -> int
Get the length of a tagged string
val tstring_of_tbuffer : Netsys_types.tbuffer -> Netsys_types.tstring
Get the tagged string of a tagged buffer
val polymorph_string_transformation : (string -> string) ->
's tstring_ops ->
't tstring_kind -> 's -> 't
polymorph_string_transformation f ops kind s
: Converts s
to a
string, runs f
on this string, and converts the result to the
type demanded by kind