pub struct ScopeSet<T, S: BuildHasher = RandomState> { /* private fields */ }
Expand description

A layered hash set for representing the scopes of variables.

Implementations

Creates an empty ScopeSet with a default hasher and capacity.

Creates an empty ScopeSet with a default hasher and the specified capacity.

Creates an empty ScopeSet with the specified hasher and a default capacity.

Creates an empty ScopeSet with the specified capacity and hasher.

Returns true is the set is empty.

Gets the number of elements the set can hold without reallocating.

Gets the number of unique keys in the set.

Gets the number of layers in the set.

Adds a new, empty layer.

Computes in O(1) time.

Removes the topmost layer (if it isn’t the bottom layer) and all associated keys. Returns true if the layer was removed.

Computes in O(n) time in relation to the number of keys stored in the removed layer.

Removes all entries and additional layers.

Removes all keys in the topmost layer.

Adds the specified key to the topmost layer.

Adds the specified key to the layer min_depth layers below the top layer. Saturates to base layer.

Removes the specified key from the topmost layer and returns it.

Returns true if any layer contains the specified key.

Computes in O(1) time.

Returns true if the topmost layer contains the specified key. Computes in O(1) time.

Gets the depth of the specified key (i.e. how many layers down from the top that the key first appears). A depth of 0 refers to the top layer.

Returns None if the key does not exist.

Computes in O(n) time (worst-case) in relation to layer count.

Gets the depth of the specified key (i.e. how many layers down from the top that the key first appears), but ignores a maximum number of layers from the top equal to min_depth. Saturates to base layer.

Returns None if the key does not exist.

Computes in O(n) time (worst-case) in relation to layer count.

Gets the height of the specified key (i.e. how many layers up from the bottom that the key last appears). A height of 0 refers to the bottom layer.

Returns None if the key does not exist.

Computes in O(n) time (worst-case) in relation to layer count.

Gets the height of the specified key (i.e. how many layers up from the bottom that the key last appears), but ignores a maximum number of layers from the top equal to min_depth. A height of 0 refers to the bottom layer. Saturates to base layer.

Returns None if the key does not exist.

Computes in O(n) time (worst-case) in relation to layer count.

Iterates over the keys in arbitrary order.

The iterator element type is &'a T.

Iterates over the top-level keys in arbitrary order.

The iterator element type is &'a T.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Creates a new ScopeSet with the default configuration.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.