package octez-libs
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/octez-libs.lazy-containers/Tezos_lazy_containers/Lazy_vector/ZVector/index.html
Module Lazy_vector.ZVectorSource
pp pp_value gives you a pretty-printer. This function is a witness of internal mutation.
to_string show vector generates a string representation of vector by using show for its values. Like pp this function is witness of internal mutation.
num_elements vector returns the maximum number of elements in the lazy vector.
val create :
?first_key:key ->
?values:'a Map.Map.t ->
?produce_value:'a producer ->
?origin:Tezos_tree_encoding.wrapped_tree ->
key ->
'a tcreate ?first_key ?values ?produce_value ?origin num_elements produces a lazy vector with num_elements entries where each is created using produce_value. values may be provided to supply an initial set of entries. first_key specifies the first index of the vector if given and defaults to zero.
Note: The produce_value and origin arguments are expected to be used by the 'tree-encoding' library. If you want to pre-fill your vector, creates an empty vector and use grow or set.
origin vec returns the tree of origin of the vector, if it exists.
Note: The sole consumer of this function is expected to be the tree-encoding library.
empty () creates a vector of size zero. This is used in conjunction with cons to model list-like structure.
of_list values creates a vector where each association is the index in the list to its value. The first item's key is zero, the second is succ zero and so on.
Note: This function may be dangerous to use in a tick, if the size of of_list is unbounded.
cons value vector prepends a value to the front and grows the vector by one. That value can then be accessed using the zero key.
split vec at splits vec into two sub vectors at element at. The first vector has at elements, the second length vec - at elements.
grow delta ?default vector creates a new lazy vector that has delta more items than vector. This also retains all values that have previously been created. New values will be created with default if provided.
Note: This function may be dangerous to use in a tick, if delta is unbounded, or if the result of default is large.
drop vector removes the head from vector without returning it. It doesn't read the value before removing it.
prepend_list l vec adds the elements of l at the front of vec.
Note: This function may be dangerous to use in a tick, if List.length l is significant.
append elt vector creates a new lazy vector that has one more item than vector whose value is elt. This is a shortcut for vector |> grow Key.(succ zero) |> set (num_elements vector) elt. Also returns the key of the added element.
concat lhs rhs concatenates two lazy vectors.
Note: This function maybe dangerous to use in a tick because every entries of both lhs and rhs will be loaded in memory.
unsafe_concat concatenates two lazy vectors, assuming every entries of both vectors are already loaded in memory.
to_list vector extracts all values of the given vector and collects them in a list.
Note: This function may be dangerous to use in a tick because all entries of the vector are loaded in memory.
loaded_bindings vector returns the (key * 'a) list representation of the vector vector containing only the loaded values, in order of increasing keys. This function is a witness of internal mutations.
val encoding :
key Tezos_tree_encoding.t ->
'a Tezos_tree_encoding.t ->
'a t Tezos_tree_encoding.tencoding len_encoding elem_encoding returns Tezos_tree_encoding for the vector