[][src]Struct runestick::Names

pub struct Names<T> { /* fields omitted */ }

A tree of names.

Implementations

impl<T> Names<T>[src]

pub fn new() -> Self[src]

Construct a collection of names.

pub fn insert<I>(&mut self, iter: I, value: T) -> Option<T> where
    I: IntoIterator,
    I::Item: IntoComponent
[src]

Insert the given item as an import.

Examples

use runestick::Names;

let mut names = Names::<()>::new();
assert!(!names.contains(&["test"]));
assert!(names.insert(&["test"], ()).is_none());
assert!(names.contains(&["test"]));
assert!(names.insert(&["test"], ()).is_some());

pub fn contains<I>(&self, iter: I) -> bool where
    I: IntoIterator,
    I::Item: IntoComponent
[src]

Test if the given import exists.

Examples

use runestick::Names;

let mut names = Names::<()>::new();
assert!(!names.contains(&["test"]));
assert!(names.insert(&["test"], ()).is_none());
assert!(names.contains(&["test"]));
assert!(names.insert(&["test"], ()).is_some());

pub fn get<I>(&self, iter: I) -> Option<&T> where
    I: IntoIterator,
    I::Item: IntoComponent
[src]

Get the given entry if it exists.

Examples

use runestick::Names;

let mut names = Names::<()>::new();
assert!(names.get(&["test"]).is_none());
assert!(names.insert(&["test"], ()).is_none());
assert!(names.get(&["test"]).is_some());
assert!(names.insert(&["test"], ()).is_some());

pub fn contains_prefix<I>(&self, iter: I) -> bool where
    I: IntoIterator,
    I::Item: IntoComponent
[src]

Test if we contain the given prefix.

pub fn iter_components<'a, I: 'a>(
    &'a self,
    iter: I
) -> impl Iterator<Item = ComponentRef<'a>> + 'a where
    I: IntoIterator,
    I::Item: IntoComponent
[src]

Iterate over all known components immediately under the specified iter path.

Trait Implementations

impl<T: Clone> Clone for Names<T>[src]

impl<T: Debug> Debug for Names<T>[src]

impl<T> Default for Names<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Names<T> where
    T: RefUnwindSafe

impl<T> Send for Names<T> where
    T: Send

impl<T> Sync for Names<T> where
    T: Sync

impl<T> Unpin for Names<T> where
    T: Unpin

impl<T> UnwindSafe for Names<T> where
    T: UnwindSafe

Blanket Implementations

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

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

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

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.