plebeia
-
plebeia
-
-
plebeia.msync
-
plebeia.test_utils
-
Library
Module
Module type
Parameter
Class
Class type
2 Side
val string_of_side : side -> string
For human readability. "L" or "R"
val string_of_sides : side list -> string
Human readable string representation of a side list, e.g. "LLLRLLRL"
2 Segment
type t = segment
Maximum length of sides which fits with one cell with an index: 215
val empty : t
The empty segment.
val is_empty : t -> bool
Cuts a path into a head and tail if not empty. Also known as "snoc".
type fat = [ `Left | `Right | `Segment of t ] list
Normal compare does not work. Note: this may call to_sides
internally and therefore is not very light operaiton.
Factors a common prefix between two segments.
common_prefix t1 t2 = (prefix, t1', t2')
then, t1 = append prefix t1'
and t2 = append prefix t2'
val unsafe_of_encoding : int -> string -> t
Fast build of a segment from a raw encoding data: the length and a string of LR bits postfixed by 0
,7
. No sanity check.
val to_encoding : t -> int * string
val to_string : t -> string
Human readable string representation of a segment, e.g. "LLLRLLRL"
val of_string : string -> t option
Parse the string representation of a segment, e.g. "LLRLLRL"
val string_of_segments : t list -> string
Human readable string representation of segments: "LLRLRLL/RRRLL/.."
val pp : Stdlib.Format.formatter -> t -> unit
val pp_debug : Stdlib.Format.formatter -> t -> unit
val pp_segments : Stdlib.Format.formatter -> t list -> unit
val length : t -> int
module Serialization : sig ... end
3 Serialization
3 Data encoding
val encoding : t Data_encoding.t
For encoding to JSON or binary using data-encoding.
Binary encoding:
<1B> <------- len bytes --------> +----+------------------------------+ |len |<- serialized segment sides ->| +----+------------------------------+
* The first byte is the length of the serialized segment sides part (1 .. 255) * The rest is the string of the serialized segment sides, which is the stream of segment bits (Left: 0, Right: 1) postfixed 10n
(0 <= n <= 7) to make the stream fit in a string.
Example:
data | binary ---------------------- empty segment | 0180 LRLRLRLRL | 025540 LRLRLRLR | 025580 RRRRRRRRRRRRRRRRRRRR | 03fffff8
2 Segs: append friendly segment list
module Segs : sig ... end
append friendly segment list
module StringEnc : sig ... end