package devkit
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=222f8ac131b1d970dab7eeb2714bfd6b9338b88b1082e6e01c136ae19e7eaef4
sha512=c9e6d93e3d21e5530c0f4d5baca51bf1f0a5d19248f8af7678d0665bb5cdf295d7aaaaa3e50eb2e44b8720e55097cc675af4dc8ec45acf9da39feb3eae1405d5
doc/devkit.ocamlnet_lite/Ocamlnet_lite/Netstring_tstring/index.html
Module Ocamlnet_lite.Netstring_tstring
Source
Support module for tagged strings
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;
(*get 3 chars packed into one int (first char shifted by 16 bits, second char shifted by 8 bits, third char unshifted)
*)copy : 't -> 't;
string : 't -> string;
(*if possible this function does not make a copy
*)bytes : 't -> Bytes.t;
(*if possible this function does not make a copy
*)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;
index_from : 't -> int -> char -> int;
index_from3 : 't -> int -> int -> char -> char -> char -> int;
(*finds any of three chars. The second int is the search radius
*)rindex_from : 't -> int -> char -> int;
rindex_from3 : 't -> int -> int -> char -> char -> char -> int;
(*finds any of three chars. The second int is the search radius
*)
}
Operations to call on strings
type tstring_ops_box =
| Tstring_ops_box : 't tstring_kind * 't tstring_ops -> tstring_ops_box
GADT for hiding the type parameter
GADT for hiding the type parameter
GADT for hiding the type parameter. Warning: This GADT does not permit you to recover the kind of string
Implementation of the operations for string
Implementation of the operations for bytes
Create a Tstring_ops_box
A polymorphic function for strings
with_tstring f ts
: Calls f.with_fun
with the right implementation of the tstring_ops
argument
Get the length of a tagged string
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