Trait RefCellLocalKeyExt

Source
pub trait RefCellLocalKeyExt<T> {
    // Required methods
    fn as_ref<'stack>(
        &'static self,
        token: &'stack StackToken,
    ) -> Ref<'stack, T>;
    fn as_mut<'stack>(
        &'static self,
        token: &'stack StackToken,
    ) -> RefMut<'stack, T>;
}
Expand description

Additional utility methods to LocalKeys holding RefCell values.

This extension traits provides the two methods as_ref and as_mut that let you directly borrow into the contained RefCell with a StackToken.

Required Methods§

Source

fn as_ref<'stack>(&'static self, token: &'stack StackToken) -> Ref<'stack, T>

Acquires a reference to the contained value.

Source

fn as_mut<'stack>(&'static self, token: &'stack StackToken) -> RefMut<'stack, T>

Acquires a mutable reference to the contained value.

Implementations on Foreign Types§

Source§

impl<T: 'static> RefCellLocalKeyExt<T> for LocalKey<RefCell<T>>

Source§

fn as_ref<'stack>(&'static self, token: &'stack StackToken) -> Ref<'stack, T>

Source§

fn as_mut<'stack>(&'static self, token: &'stack StackToken) -> RefMut<'stack, T>

Implementors§