Skip to main content

ParamDescribed

Trait ParamDescribed 

Source
pub trait ParamDescribed {
    // Required methods
    fn params(&self) -> &[Param];
    fn params_mut(&mut self) -> &mut ParamList;

    // Provided methods
    fn add_param(&mut self, param: Param) { ... }
    fn extend_params(&mut self, it: impl IntoIterator<Item = Param>) { ... }
    fn remove_param(&mut self, index: usize) -> Param { ... }
    fn get_param_by_name(&self, name: &str) -> Option<&Param> { ... }
    fn get_param_by_curie(&self, curie: &CURIE) -> Option<&Param> { ... }
    fn get_param_by_accession(&self, accession: &str) -> Option<&Param> { ... }
    fn iter_params(&self) -> Iter<'_, Param>  { ... }
    fn iter_params_mut(&mut self) -> IterMut<'_, Param>  { ... }
}
Expand description

A type that has a ParamList that uses Param instances to describe an entity with key-value pairs.

Required Methods§

Source

fn params(&self) -> &[Param]

Obtain an immutable slice over the encapsulated Param list

Source

fn params_mut(&mut self) -> &mut ParamList

Obtain an mutable slice over the encapsulated Param list

Provided Methods§

Source

fn add_param(&mut self, param: Param)

Add a new Param to the entity

Source

fn extend_params(&mut self, it: impl IntoIterator<Item = Param>)

Add all parameters from an iterator of Param to the entity

Source

fn remove_param(&mut self, index: usize) -> Param

Remove the ith Param from the entity.

Source

fn get_param_by_name(&self, name: &str) -> Option<&Param>

Find the first Param whose name matches name

Source

fn get_param_by_curie(&self, curie: &CURIE) -> Option<&Param>

Find the first Param whose CURIE matches curie

Source

fn get_param_by_accession(&self, accession: &str) -> Option<&Param>

Find the first Param whose Param::accession matches accession

This is equivalent to ParamDescribed::get_param_by_curie on accession.parse::<CURIE>().unwrap()

Source

fn iter_params(&self) -> Iter<'_, Param>

Iterate over the encapsulated parameter list

Source

fn iter_params_mut(&mut self) -> IterMut<'_, Param>

Iterate mutably over the encapsulated parameter list

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§