[][src]Struct zypo_lib::parser::scope::Scope

pub struct Scope<K: Hash + Eq, V>(_);

Structure for storing an AST node as a hashmap node inside of a vector.

To use this structure, a node type has to implament Hash and Eq (similar to PartialEq).

Methods

impl<K: Hash + Eq, V> Scope<K, V>[src]

pub fn new() -> Self[src]

Creates a new, empty scope.

pub fn enter_scope(&mut self)[src]

Creates a new scope at top of stack, acting as a new scope.

pub fn leave_scope(&mut self)[src]

Leaves the scope by popping the top value of the HashMap vector stack.

pub fn get(&self, item: &K) -> Option<&V>[src]

Scans bottom-up from the scope stack to find the specified item argument. This method recurses down the branches of the stack until it finds the item (linear search).

pub fn insert(&mut self, key: K, value: V) -> Option<V>[src]

Inserts a new item into the stack.

NOTE: This will panic if a fatal error occurs if inserting into a broken stack.

pub fn depth(&self) -> usize[src]

Gets the depth of the entire Scope data structure.

Auto Trait Implementations

impl<K, V> Send for Scope<K, V> where
    K: Send,
    V: Send

impl<K, V> Sync for Scope<K, V> where
    K: Sync,
    V: Sync

impl<K, V> Unpin for Scope<K, V> where
    K: Unpin,
    V: Unpin

impl<K, V> UnwindSafe for Scope<K, V> where
    K: UnwindSafe,
    V: UnwindSafe

impl<K, V> RefUnwindSafe for Scope<K, V> where
    K: RefUnwindSafe,
    V: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]