package tezos-protocol-017-PtNairob
Slot index
A slot index is a possible value for a slot index with an upper bound. If a choice is ever made to increase the size of available slots in the protocol, we also need to change this module to accommodate for higher values.
val max_value : t
val encoding : t Tezos_protocol_environment_017_PtNairob.Data_encoding.t
val pp : Tezos_protocol_environment_017_PtNairob.Format.formatter -> t -> unit
val zero : t
val check_is_in_range :
t ->
unit Tezos_protocol_environment_017_PtNairob.Error_monad.tzresult
val of_int :
int ->
t Tezos_protocol_environment_017_PtNairob.Error_monad.tzresult
of_int n
constructs a value of type t
from n
. Returns Invalid_slot_index
in case the given value is not in the interval [zero, max_value]
.
val of_int_opt : int -> t option
of_int_opt n
constructs a value of type t
from n
. Returns None
in case the given value is not in the interval [zero, max_value]
.
val to_int : t -> int
val to_int_list : t list -> int list
val slots_range :
lower:int ->
upper:int ->
t list Tezos_protocol_environment_017_PtNairob.Error_monad.tzresult
slots_range ~lower ~upper
returns the list of slots indexes between lower
and upper
.
If lower
is negative or upper
is bigger than max_value
, the function returns Invalid_slot_index
.
val slots_range_opt : lower:int -> upper:int -> t list option
slots_range_opt ~lower ~upper
is similar to slots_range
, but return None
instead of an error.