Module Cmarkit.Span

String spans.

A span determines a substring in a larger string.

type t

The type for spans. Holds a string and determines a substring therein.

val v : string -> first:int -> last:int -> t

v s ~first ~last spans the bytes first to last of s. If first > last this is an empty span.

val is_empty : t -> bool

is_empty s is true iff s is an empty span.

val first : t -> int

first s is the first byte of the span.

val last : t -> int

last s is the last byte of the span.

val string : t -> string

string s is the string to which the span belongs.

val of_string : string -> t

of_string s is a string span spanning s.

val to_string : t -> string

to_string s is a string with the bytes of the span s.