Skip to main content

PortCollection

Trait PortCollection 

Source
pub trait PortCollection: Debug {
    // Required methods
    fn find(&self, name: &str) -> Option<&PortVariant>;
    fn find_mut(&mut self, name: &str) -> Option<&mut PortVariant>;
    fn set_from_str(&mut self, name: &str, value: &str) -> Result<(), Error>;
    fn iter<'a>(
        &'a self,
    ) -> Box<dyn Iterator<Item = (&'a str, &'a PortVariant)> + 'a>;
    fn iter_mut<'a>(
        &'a mut self,
    ) -> Box<dyn Iterator<Item = (&'a str, &'a mut PortVariant)> + 'a>;
}
Expand description

Methods for something that is a collection of ports. Each port is identified by its name, so the name has to be unique within a certain port collection.

Required Methods§

Source

fn find(&self, name: &str) -> Option<&PortVariant>

Returns the port with ‘name’ from the collection.

Source

fn find_mut(&mut self, name: &str) -> Option<&mut PortVariant>

Returns the mutable port with ‘name’ from the collection.

Source

fn set_from_str(&mut self, name: &str, value: &str) -> Result<(), Error>

Sets a new value created from str to the T.

§Errors
Source

fn iter<'a>( &'a self, ) -> Box<dyn Iterator<Item = (&'a str, &'a PortVariant)> + 'a>

Returns a boxed iterator yielding (name, port) pairs for every entry in the collection.

Source

fn iter_mut<'a>( &'a mut self, ) -> Box<dyn Iterator<Item = (&'a str, &'a mut PortVariant)> + 'a>

Returns a boxed iterator yielding (name, &mut port) pairs for every entry in the collection.

Implementors§