[−][src]Struct quickscope::ScopeSet
A layered hash set for representing the scopes of variables.
Implementations
impl<T> ScopeSet<T, RandomState>
[src]
pub fn new() -> Self
[src]
Creates an empty ScopeSet
with a default hasher and capacity.
pub fn with_capacity(capacity: usize) -> Self
[src]
Creates an empty ScopeSet
with a default hasher and the specified capacity.
impl<T, S: BuildHasher> ScopeSet<T, S>
[src]
pub fn with_hasher(hash_builder: S) -> Self
[src]
Creates an empty ScopeSet
with the specified hasher and a default capacity.
pub fn with_capacity_and_hasher(capacity: usize, hash_builder: S) -> Self
[src]
Creates an empty ScopeSet
with the specified capacity and hasher.
impl<T, S: BuildHasher> ScopeSet<T, S>
[src]
pub fn is_empty(&self) -> bool
[src]
Returns true
is the set is empty.
pub fn capacity(&self) -> usize
[src]
Gets the number of elements the set can hold without reallocating.
pub fn len(&self) -> usize
[src]
Gets the number of unique keys in the set.
pub fn depth(&self) -> usize
[src]
Gets the number of layers in the set.
pub fn push_layer(&mut self)
[src]
Adds a new, empty layer.
Computes in O(1) time.
pub fn pop_layer(&mut self) -> bool
[src]
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.
impl<T: Eq + Hash, S: BuildHasher> ScopeSet<T, S>
[src]
pub fn clear_all(&mut self)
[src]
Removes all entries and additional layers.
pub fn clear_top(&mut self)
[src]
Removes all keys in the topmost layer.
pub fn define(&mut self, key: T)
[src]
Adds the specified key to the topmost layer.
pub fn delete(&mut self, key: T) -> bool
[src]
Removes the specified key from the topmost layer.
pub fn contains<Q: ?Sized>(&self, key: &Q) -> bool where
T: Borrow<Q>,
Q: Eq + Hash,
[src]
T: Borrow<Q>,
Q: Eq + Hash,
Returns true
if any layer contains the specified key.
Computes in O(1) time.
pub fn contains_at_top<Q: ?Sized>(&self, key: &Q) -> bool where
T: Borrow<Q>,
Q: Eq + Hash,
[src]
T: Borrow<Q>,
Q: Eq + Hash,
Returns true
if the topmost layer contains the specified key.
Computes in O(1) time.
pub fn depth_of<Q: ?Sized>(&self, key: &Q) -> Option<usize> where
T: Borrow<Q>,
Q: Eq + Hash,
[src]
T: Borrow<Q>,
Q: Eq + Hash,
Gets the depth of the specified key (i.e. how many layers down the key is). A depth of 0 means that the current layer contains the key.
Returns None
if the key does not exist.
Computes in O(n) time (worst-case) in relation to layer count.
Trait Implementations
impl<T: Clone, S: Clone + BuildHasher> Clone for ScopeSet<T, S>
[src]
impl<T, S: Default + BuildHasher> Default for ScopeSet<T, S>
[src]
Auto Trait Implementations
impl<T, S> RefUnwindSafe for ScopeSet<T, S> where
S: RefUnwindSafe,
T: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S> Send for ScopeSet<T, S> where
S: Send,
T: Send,
S: Send,
T: Send,
impl<T, S> Sync for ScopeSet<T, S> where
S: Sync,
T: Sync,
S: Sync,
T: Sync,
impl<T, S> Unpin for ScopeSet<T, S> where
S: Unpin,
T: Unpin,
S: Unpin,
T: Unpin,
impl<T, S> UnwindSafe for ScopeSet<T, S> where
S: UnwindSafe,
T: UnwindSafe,
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,