package gapi-ocaml

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Support module for tagged strings

type _ tstring_kind =
  1. | String_kind : string tstring_kind
  2. | Bytes_kind : Bytes.t tstring_kind
  3. | Memory_kind : Netsys_types.memory tstring_kind

GADT for encoding the string type (string/bytes/bigarray)

type 't tstring_ops = {
  1. kind : 't tstring_kind option;
  2. length : 't -> int;
  3. get : 't -> int -> char;
  4. unsafe_get : 't -> int -> char;
  5. 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)

    *)
  6. copy : 't -> 't;
  7. string : 't -> string;
    (*

    if possible this function does not make a copy

    *)
  8. bytes : 't -> Bytes.t;
    (*

    if possible this function does not make a copy

    *)
  9. sub : 't -> int -> int -> 't;
  10. substring : 't -> int -> int -> string;
  11. subbytes : 't -> int -> int -> Bytes.t;
  12. subpoly : 'u. 'u tstring_kind -> 't -> int -> int -> 'u;
  13. blit_to_bytes : 't -> int -> Bytes.t -> int -> int -> unit;
  14. blit_to_memory : 't -> int -> Netsys_types.memory -> int -> int -> unit;
  15. index_from : 't -> int -> char -> int;
  16. index_from3 : 't -> int -> int -> char -> char -> char -> int;
    (*

    finds any of three chars. The second int is the search radius

    *)
  17. rindex_from : 't -> int -> char -> int;
  18. 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 =
  1. | Tstring_ops_box : 't tstring_kind * 't tstring_ops -> tstring_ops_box

GADT for hiding the type parameter

type tstring_box =
  1. | Tstring_box : 't tstring_kind * 't tstring_ops * 't -> tstring_box

GADT for hiding the type parameter

type tstring_polybox =
  1. | Tstring_polybox : 't tstring_ops * 't -> 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 string

Implementation of the operations for bytes

Implementation of the operations for bytes

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 = {
  1. with_fun : 's. 's tstring_ops -> 's -> 'a;
}

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

OCaml

Innovation. Community. Security.