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§
Sourcefn find(&self, name: &str) -> Option<&PortVariant>
fn find(&self, name: &str) -> Option<&PortVariant>
Returns the port with ‘name’ from the collection.
Sourcefn find_mut(&mut self, name: &str) -> Option<&mut PortVariant>
fn find_mut(&mut self, name: &str) -> Option<&mut PortVariant>
Returns the mutable port with ‘name’ from the collection.
Sourcefn set_from_str(&mut self, name: &str, value: &str) -> Result<(), Error>
fn set_from_str(&mut self, name: &str, value: &str) -> Result<(), Error>
Sets a new value created from str to the T.
§Errors
Error::DataType, if ‘name’ has not the expected type of T.Error::PortType, if ‘name’ is not the expected port type.