module type S =sig
..end
module Key:Hash_queue.Key
type 'a
t
include Container.S1
val invariant : 'a t -> unit
invariant t
checks the invariants of the queue.val create : unit -> 'a t
create ()
returns an empty queue.val clear : 'a t -> unit
val mem : 'a t -> Key.t -> bool
mem q k
returns true iff there is some (k, v) in the queue.val lookup : 'a t -> Key.t -> 'a option
lookup t k
returns the value of the key-value pair in the queue with
key k, if there is one.val lookup_exn : 'a t -> Key.t -> 'a
val enqueue : 'a t -> Key.t -> 'a -> [ `Key_already_present | `Ok ]
enqueue t k v
adds the key-value pair (k, v) to the end of the queue,
returning `Ok if the pair was added, or `Key_already_present
if there is already a (k, v') in the queue.val enqueue_exn : 'a t -> Key.t -> 'a -> unit
val keys : 'a t -> Key.t list
keys t
returns the keys in the order of the queue.val dequeue : 'a t -> 'a option
dequeue t
returns the front element of the queue.val dequeue_exn : 'a t -> 'a
val dequeue_with_key : 'a t -> (Key.t * 'a) option
dequeue_with_key t
returns the front element of the queue and its keyval dequeue_with_key_exn : 'a t -> Key.t * 'a
val dequeue_all : 'a t -> f:('a -> unit) -> unit
dequeue_all t ~f
dequeues every element of the queue and applies f to each
one.
remove q k
removes the key-value pair with key k from the queue.
val remove : 'a t -> Key.t -> [ `No_such_key | `Ok ]
val remove_exn : 'a t -> Key.t -> unit
val replace : 'a t -> Key.t -> 'a -> [ `No_such_key | `Ok ]
replace q k v
changes the value of key k in the queue to v.val replace_exn : 'a t -> Key.t -> 'a -> unit
val iteri : 'a t -> f:(key:Key.t -> data:'a -> unit) -> unit
iter t ~f
applies f to each key and element of the queue.val foldi : 'a t -> init:'b -> f:('b -> key:Key.t -> data:'a -> 'b) -> 'b