Cuckoo v1.0.2 Cuckoo.Bucket View Source

This module implements a Bucket.

Link to this section Summary

Functions

Returns true if the bucket contains the element, otherwise returns false

Tries to find the given element in the bucket

Returns the element at the specified index

Checks if the bucket has any room left

Creates a new bucket with the given size n

Resets the entry index to the default value

Sets the entry index to element

Link to this section Types

Link to this section Functions

Link to this function contains?(bucket, element) View Source
contains?(t(), pos_integer()) :: boolean()

Returns true if the bucket contains the element, otherwise returns false.

Link to this function find(bucket, element) View Source
find(t(), pos_integer()) :: {:ok, non_neg_integer()} | {:error, :inexistent}

Tries to find the given element in the bucket.

Returns {:ok, index} if it finds it, otherwise returns {:error, :inexistent}.

Returns the element at the specified index.

Link to this function has_room?(bucket) View Source
has_room?(t()) :: {:ok, pos_integer()} | {:error, :full}

Checks if the bucket has any room left.

Returns { :ok, index } if it finds an empty entry in the bucket, otherwise returns { :error, :full }.

Creates a new bucket with the given size n.

Link to this function reset(bucket, index) View Source
reset(t(), non_neg_integer()) :: t()

Resets the entry index to the default value.

Returns the updated bucket.

Link to this function set(bucket, index, element) View Source
set(t(), non_neg_integer(), pos_integer()) :: t()

Sets the entry index to element.

Returns the updated bucket.