pub struct Param {
pub name: String,
pub value: Value,
pub accession: Option<AccessionIntCode>,
pub controlled_vocabulary: Option<ControlledVocabulary>,
pub unit: Unit,
}Expand description
A controlled vocabulary or user parameter
Fields§
§name: StringThe human-readable name of the parameter.
value: ValueA type generic value associated with the parameter
accession: Option<AccessionIntCode>The numeric component of the accession code in the identifier for the parameter’s
definition in Self::controlled_vocabulary, if it is defined by one.
controlled_vocabulary: Option<ControlledVocabulary>The controlled vocabulary this parameter is defined in, if any.
unit: UnitThe unit the parameter’s value is expressed in, if any.
Implementations§
Source§impl Param
impl Param
Sourcepub fn builder() -> ParamBuilder
pub fn builder() -> ParamBuilder
Create a new ParamBuilder to make creating a new Param more convenient than
setting fields on a bare Param directly.
Sourcepub fn new_key_value<K: Into<String>, V: Into<Value>>(
name: K,
value: V,
) -> Param
pub fn new_key_value<K: Into<String>, V: Into<Value>>( name: K, value: V, ) -> Param
A construction method for Param that sets Param::name and Param::value
but leaves all other attributes as default.
Sourcepub fn parse<T: FromStr>(&self) -> Result<T, T::Err>
pub fn parse<T: FromStr>(&self) -> Result<T, T::Err>
Attempt to parse the value of this parameter into T.
See Value::parse
Sourcepub const fn is_controlled(&self) -> bool
pub const fn is_controlled(&self) -> bool
Check if this parameter is defined in a controlled vocabulary
Sourcepub const fn curie(&self) -> Option<CURIE>
pub const fn curie(&self) -> Option<CURIE>
Create a CURIE from Param::controlled_vocabulary and Param::accession
Sourcepub fn curie_str(&self) -> Option<String>
pub fn curie_str(&self) -> Option<String>
Format the Param::curie as a string, if it exists
Sourcepub fn with_unit<S: AsRef<str>, A: AsRef<str>>(
self,
accession: S,
name: A,
) -> Param
pub fn with_unit<S: AsRef<str>, A: AsRef<str>>( self, accession: S, name: A, ) -> Param
Update Param::unit inferred from accession, failing that, name
§See also
Param::with_unit_t, to infer the unit from a resolvedUnit
Sourcepub fn with_unit_t(self, unit: &Unit) -> Param
pub fn with_unit_t(self, unit: &Unit) -> Param
Set Param::unit directly from unit.
§See also
Param::with_unit, to infer the unit from an accession or name instead
Trait Implementations§
impl Eq for Param
Source§impl ParamLike for Param
impl ParamLike for Param
Source§fn accession(&self) -> Option<AccessionIntCode>
fn accession(&self) -> Option<AccessionIntCode>
ParamLike::controlled_vocabulary, if this
parameter is drawn from a controlled vocabulary.Source§fn controlled_vocabulary(&self) -> Option<ControlledVocabulary>
fn controlled_vocabulary(&self) -> Option<ControlledVocabulary>
Source§fn is_ms(&self) -> bool
fn is_ms(&self) -> bool
Source§fn parse<T: FromStr>(&self) -> Result<T, T::Err>
fn parse<T: FromStr>(&self) -> Result<T, T::Err>
T. See ParamValue::parse.Source§fn is_controlled(&self) -> bool
fn is_controlled(&self) -> bool
Source§impl ParamValue for Param
impl ParamValue for Param
Source§fn is_f64(&self) -> bool
fn is_f64(&self) -> bool
Source§fn is_str(&self) -> bool
fn is_str(&self) -> bool
Source§fn to_buffer(&self) -> Result<Cow<'_, [u8]>, ParamValueParseError>
fn to_buffer(&self) -> Result<Cow<'_, [u8]>, ParamValueParseError>
Source§fn parse<T: FromStr>(&self) -> Result<T, T::Err>
fn parse<T: FromStr>(&self) -> Result<T, T::Err>
T if possible