Skip to main content

ParamLike

Trait ParamLike 

Source
pub trait ParamLike {
    // Required methods
    fn name(&self) -> &str;
    fn value(&self) -> ValueRef<'_>;
    fn accession(&self) -> Option<AccessionIntCode>;
    fn controlled_vocabulary(&self) -> Option<ControlledVocabulary>;
    fn unit(&self) -> Unit;

    // Provided methods
    fn is_ms(&self) -> bool { ... }
    fn parse<T: FromStr>(&self) -> Result<T, T::Err> { ... }
    fn is_controlled(&self) -> bool { ... }
    fn curie(&self) -> Option<CURIE> { ... }
}
Expand description

A minimal, read-only view over a single CV or user-defined parameter.

Both Param and ParamCow implement this trait; prefer it when writing code that should work with either the owned or borrowed representation.

Required Methods§

Source

fn name(&self) -> &str

The human-readable name of the parameter.

Source

fn value(&self) -> ValueRef<'_>

A borrowed view of the parameter’s value.

Source

fn accession(&self) -> Option<AccessionIntCode>

The numeric accession code within ParamLike::controlled_vocabulary, if this parameter is drawn from a controlled vocabulary.

Source

fn controlled_vocabulary(&self) -> Option<ControlledVocabulary>

The controlled vocabulary this parameter’s term belongs to, if any.

Source

fn unit(&self) -> Unit

The unit the parameter’s value is expressed in, if known.

Provided Methods§

Source

fn is_ms(&self) -> bool

Check whether this parameter’s term belongs to the PSI-MS controlled vocabulary.

Source

fn parse<T: FromStr>(&self) -> Result<T, T::Err>

Parse the parameter’s value as T. See ParamValue::parse.

Source

fn is_controlled(&self) -> bool

Check whether this parameter is drawn from a controlled vocabulary, as opposed to being a free-text user-defined parameter.

Source

fn curie(&self) -> Option<CURIE>

Build a CURIE from ParamLike::controlled_vocabulary and ParamLike::accession, if both are present.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§