module Netstring_tstring:sig..end
Support module for tagged strings
type '_ tstring_kind =
| |
String_kind : |
| |
Bytes_kind : |
| |
Memory_kind : |
GADT for encoding the string type (string/bytes/bigarray)
type 't tstring_ops = {
|
kind : |
|||
|
length : |
|||
|
get : |
|||
|
unsafe_get : |
|||
|
unsafe_get3 : |
(* | get 3 chars packed into one int (first char shifted by 16 bits, second char shifted by 8 bits, third char unshifted) | *) |
|
copy : |
|||
|
string : |
(* | if possible this function does not make a copy | *) |
|
bytes : |
(* | if possible this function does not make a copy | *) |
|
sub : |
|||
|
substring : |
|||
|
subbytes : |
|||
|
subpoly : |
|||
|
blit_to_bytes : |
|||
|
blit_to_memory : |
|||
|
index_from : |
|||
|
index_from3 : |
(* | finds any of three chars. The second int is the search radius | *) |
|
rindex_from : |
|||
|
rindex_from3 : |
(* | finds any of three chars. The second int is the search radius | *) |
Operations to call on strings
type tstring_ops_box =
| |
Tstring_ops_box : |
GADT for hiding the type parameter
type tstring_box =
| |
Tstring_box : |
GADT for hiding the type parameter
type tstring_polybox =
| |
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_opsImplementation of the operations for string
val bytes_ops : Stdlib.Bytes.t tstring_opsImplementation of the operations for bytes
val memory_ops : Netsys_types.memory tstring_opsImplementation of the operations for memory
val ops_of_tstring : Netsys_types.tstring -> tstring_ops_boxCreate a Tstring_ops_box
type 'a with_fun = {
|
with_fun : |
A polymorphic function for strings
val with_tstring : 'a with_fun -> Netsys_types.tstring -> 'awith_tstring f ts: Calls f.with_fun with the right implementation of
the tstring_ops argument
val length_tstring : Netsys_types.tstring -> intGet the length of a tagged string
val tstring_of_tbuffer : Netsys_types.tbuffer -> Netsys_types.tstringGet the tagged string of a tagged buffer
val polymorph_string_transformation : (string -> string) ->
's tstring_ops ->
't tstring_kind -> 's -> 'tpolymorph_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