Struct Param

Source
pub struct Param {
    pub name: String,
    pub value: Value,
    pub accession: Option<u32>,
    pub controlled_vocabulary: Option<ControlledVocabulary>,
    pub unit: Unit,
}
Expand description

A controlled vocabulary or user parameter

Fields§

§name: String§value: Value§accession: Option<u32>§controlled_vocabulary: Option<ControlledVocabulary>§unit: Unit

Implementations§

Source§

impl Param

Source

pub fn new() -> Param

Source

pub fn builder() -> ParamBuilder

Create a new ParamBuilder to make creating a new Param more convenient.

Source

pub fn new_key_value<K, V>(name: K, value: V) -> Param
where K: Into<String>, V: Into<Value>,

A construction method for Param that sets Param::name and Param::value but leaves all other attributes as default.

Source

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

Attempt to parse the value of this parameter into T.

See Value::parse

Source

pub const fn is_controlled(&self) -> bool

Check if this parameter is defined in a controlled vocabulary

Source

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

Source

pub fn curie_str(&self) -> Option<String>

Format the Param::curie as a string, if it exists

Source

pub fn with_unit<S, A>(self, accession: S, name: A) -> Param
where S: AsRef<str>, A: AsRef<str>,

Update Param::unit inferred from accession, failing that, name

Source

pub fn with_unit_t(self, unit: &Unit) -> Param

Update Param::unit from unit

Trait Implementations§

Source§

impl AsRef<Value> for Param

Source§

fn as_ref(&self) -> &Value

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Param

Source§

fn clone(&self) -> Param

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Param

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Param

Source§

fn default() -> Param

Returns the “default value” for a type. Read more
Source§

impl Display for Param

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl From<&DetectorTypeTerm> for Param

Source§

fn from(value: &DetectorTypeTerm) -> Param

Converts to this type from the input type.
Source§

impl From<&DissociationEnergyTerm> for Param

Source§

fn from(value: &DissociationEnergyTerm) -> Param

Converts to this type from the input type.
Source§

impl From<&DissociationMethodTerm> for Param

Source§

fn from(value: &DissociationMethodTerm) -> Param

Converts to this type from the input type.
Source§

impl From<&InletTypeTerm> for Param

Source§

fn from(value: &InletTypeTerm) -> Param

Converts to this type from the input type.
Source§

impl From<&IonizationTypeTerm> for Param

Source§

fn from(value: &IonizationTypeTerm) -> Param

Converts to this type from the input type.
Source§

impl From<&MassAnalyzerTerm> for Param

Source§

fn from(value: &MassAnalyzerTerm) -> Param

Converts to this type from the input type.
Source§

impl From<&MassSpectrometerFileFormatTerm> for Param

Source§

fn from(value: &MassSpectrometerFileFormatTerm) -> Param

Converts to this type from the input type.
Source§

impl From<&NativeSpectrumIdentifierFormatTerm> for Param

Source§

fn from(value: &NativeSpectrumIdentifierFormatTerm) -> Param

Converts to this type from the input type.
Source§

impl From<&SoftwareTerm> for Param

Source§

fn from(value: &SoftwareTerm) -> Param

Converts to this type from the input type.
Source§

impl From<DataProcessingAction> for Param

Source§

fn from(value: DataProcessingAction) -> Param

Converts to this type from the input type.
Source§

impl From<DetectorTypeTerm> for Param

Source§

fn from(value: DetectorTypeTerm) -> Param

Converts to this type from the input type.
Source§

impl From<DissociationEnergyTerm> for Param

Source§

fn from(value: DissociationEnergyTerm) -> Param

Converts to this type from the input type.
Source§

impl From<DissociationMethodTerm> for Param

Source§

fn from(value: DissociationMethodTerm) -> Param

Converts to this type from the input type.
Source§

impl From<FormatConversion> for Param

Source§

fn from(value: FormatConversion) -> Param

Converts to this type from the input type.
Source§

impl From<InletTypeTerm> for Param

Source§

fn from(value: InletTypeTerm) -> Param

Converts to this type from the input type.
Source§

impl From<IonizationTypeTerm> for Param

Source§

fn from(value: IonizationTypeTerm) -> Param

Converts to this type from the input type.
Source§

impl From<MassAnalyzerTerm> for Param

Source§

fn from(value: MassAnalyzerTerm) -> Param

Converts to this type from the input type.
Source§

impl From<MassSpectrometerFileFormatTerm> for Param

Source§

fn from(value: MassSpectrometerFileFormatTerm) -> Param

Converts to this type from the input type.
Source§

impl From<NativeSpectrumIdentifierFormatTerm> for Param

Source§

fn from(value: NativeSpectrumIdentifierFormatTerm) -> Param

Converts to this type from the input type.
Source§

impl<'a> From<ParamCow<'a>> for Param

Source§

fn from(value: ParamCow<'a>) -> Param

Converts to this type from the input type.
Source§

impl From<SoftwareTerm> for Param

Source§

fn from(value: SoftwareTerm) -> Param

Converts to this type from the input type.
Source§

impl Hash for Param

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl ParamLike for Param

Source§

fn name(&self) -> &str

Source§

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

Source§

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

Source§

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

Source§

fn unit(&self) -> Unit

Source§

fn is_ms(&self) -> bool

Source§

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

Source§

fn is_controlled(&self) -> bool

Source§

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

Source§

impl ParamValue for Param

Source§

fn is_empty(&self) -> bool

Check if the value is empty
Source§

fn is_i64(&self) -> bool

Check if the value is an integer
Source§

fn is_f64(&self) -> bool

Check if the value is a floating point number explicitly. An integral number might still be usable as a floating point number
Source§

fn is_buffer(&self) -> bool

Check if the value is an arbitrary buffer
Source§

fn is_str(&self) -> bool

Check if the value is stored as an explicit string. All variants can be coerced to a string.
Source§

fn to_f64(&self) -> Result<f64, ParamValueParseError>

Get the value as an f64, if possible
Source§

fn to_i64(&self) -> Result<i64, ParamValueParseError>

Get the value as an i64, if possible
Source§

fn to_str(&self) -> Cow<'_, str>

Get the value as a string
Source§

fn to_buffer(&self) -> Result<Cow<'_, [u8]>, ParamValueParseError>

Get the value as a byte buffer, if possible. Read more
Source§

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

Convert the value’s string representation to T if possible
Source§

fn as_bytes(&self) -> Cow<'_, [u8]>

Convert the value to a byte string, the bytes of the string representation.
Source§

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

Get a reference to the stored value
Source§

fn data_len(&self) -> usize

Get the size of the stored data type
Source§

fn is_boolean(&self) -> bool

Check if the value is a boolean
Source§

fn to_bool(&self) -> Result<bool, ParamValueParseError>

Get the value as a bool, if possible
Source§

fn is_numeric(&self) -> bool

Check if the value is of either numeric type.
Source§

fn to_f32(&self) -> Result<f32, ParamValueParseError>

Get the value as an f32, if possible
Source§

fn to_i32(&self) -> Result<i32, ParamValueParseError>

Get the value as an i32, if possible
Source§

fn to_u64(&self) -> Result<u64, ParamValueParseError>

Get the value as an u64, if possible
Source§

fn as_str(&self) -> Cow<'_, str>

Get the value as a string, possibly borrowed
Source§

impl PartialEq<CURIE> for Param

Source§

fn eq(&self, other: &CURIE) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Param> for ParamCow<'_>

Source§

fn eq(&self, other: &Param) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<ParamCow<'a>> for Param

Source§

fn eq(&self, other: &ParamCow<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for Param

Source§

fn eq(&self, other: &Param) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<&Param> for CURIE

Source§

type Error = String

The type returned in the event of a conversion error.
Source§

fn try_from(value: &Param) -> Result<CURIE, <CURIE as TryFrom<&Param>>::Error>

Performs the conversion.
Source§

impl TryFrom<MassSpectrometryFormat> for Param

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_from( value: MassSpectrometryFormat, ) -> Result<Param, <Param as TryFrom<MassSpectrometryFormat>>::Error>

Performs the conversion.
Source§

impl Eq for Param

Source§

impl StructuralPartialEq for Param

Auto Trait Implementations§

§

impl Freeze for Param

§

impl RefUnwindSafe for Param

§

impl Send for Param

§

impl Sync for Param

§

impl Unpin for Param

§

impl UnwindSafe for Param

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.