package tezos-protocol-alpha

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t

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 zero : t
type Tezos_protocol_environment_alpha.Error_monad.error +=
  1. | Invalid_slot_index of {
    1. given : t;
    2. min : t;
    3. max : t;
    }
val check_is_in_range : number_of_slots:int -> t -> unit Tezos_protocol_environment_alpha.Error_monad.tzresult
val of_int : number_of_slots:int -> int -> t Tezos_protocol_environment_alpha.Error_monad.tzresult

of_int ~number_of_slots n constructs a value of type t from n. Returns Invalid_slot_index in case the given value is not in the interval [zero, number_of_slots-1].

val of_int_opt : number_of_slots:int -> int -> t option

of_int_opt ~number_of_slots n constructs a value of type t from n. Returns None in case the given value is not in the interval [zero, number_of_slots-1].

val to_int : t -> int
val to_int_list : t list -> int list
val slots_range : number_of_slots:int -> lower:int -> upper:int -> t list Tezos_protocol_environment_alpha.Error_monad.tzresult

slots_range ~number_of_slots ~lower ~upper returns the list of slots indexes between lower and upper.

If lower is negative or upper is bigger than or equal to number_of_slots, the function returns Invalid_slot_index.

val slots_range_opt : number_of_slots:int -> lower:int -> upper:int -> t list option

slots_range_opt ~number_of_slots ~lower ~upper is similar to slots_range, but return None instead of an error.

val is_succ : t -> succ:t -> bool

is_succ elt ~succ returns true if and only if elt + 1 = succ.

include Tezos_protocol_environment_alpha.Compare.S with type t := t
val (=) : t -> t -> bool
val (<>) : t -> t -> bool
val (<) : t -> t -> bool
val (<=) : t -> t -> bool
val (>=) : t -> t -> bool
val (>) : t -> t -> bool
val compare : t -> t -> int
val equal : t -> t -> bool
val max : t -> t -> t
val min : t -> t -> t
OCaml

Innovation. Community. Security.