pub trait ValidNames {
    // Required method
    fn push(&mut self, s: &str);

    // Provided method
    fn run(self, names: &impl Fn(&mut dyn ValidNames)) -> Self
       where Self: Sized { ... }
}
Expand description

A trait for types storing a set of valid names.

Required Methods§

source

fn push(&mut self, s: &str)

Adds the name s to the set.

Provided Methods§

source

fn run(self, names: &impl Fn(&mut dyn ValidNames)) -> Self
where Self: Sized,

Runs the function names provided with self as the store and then returns back self. This method exists for convenience.

Implementations§

source§

impl dyn ValidNames + '_

source

pub fn extend<I: IntoIterator>(&mut self, iter: I)
where I::Item: AsRef<str>,

Adds the names in iter to the set.

Implementors§