Module Types.Collection

A generic interface to access a readonly sequential collection of unique keyed items.

type 't t = 't t_collection

The number of items in the collection.

val get_size : 't t -> unit -> float

Iterate over all keys in the collection.

The number of items in the collection.

val get_keys : 't t -> unit -> string array

Get an item by its key.

Iterate over all keys in the collection.

val get_item : 't t -> string -> 't option

Get an item by the index of its key.

Get an item by its key.

val at : 't t -> float -> 't option

Get the key that comes before the given key in the collection.

Get an item by the index of its key.

val get_key_before : 't t -> string -> string option

Get the key that comes after the given key in the collection.

Get the key that comes before the given key in the collection.

val get_key_after : 't t -> string -> string option

Get the first key in the collection.

Get the key that comes after the given key in the collection.

val get_first_key : 't t -> unit -> string option

Get the last key in the collection.

Get the first key in the collection.

val get_last_key : 't t -> unit -> string option

Get the last key in the collection.

val make : get_size:(unit -> float) -> get_keys:(unit -> string array) -> get_item:(string -> 't option) -> at:(float -> 't option) -> get_key_before:(string -> string option) -> get_key_after:(string -> string option) -> get_first_key:(unit -> string option) -> get_last_key:(unit -> string option) -> unit -> 't t