Skip to main content

Param

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

The human-readable name of the parameter.

§value: Value

A type generic value associated with the parameter

§accession: Option<u32>

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: Unit

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

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 than setting fields on a bare Param directly.

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

§See also
Source

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

Set Param::unit directly from unit.

§See also

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 (const: unstable) · 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<'de> Deserialize<'de> for Param

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Param, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. 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 Eq for Param

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<&SpectrumType> for Param

Source§

fn from(value: &SpectrumType) -> 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 From<Param> for PROXIParam

Source§

fn from(value: Param) -> Self

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 From<SpectrumType> for Param

Source§

fn from(value: SpectrumType) -> 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

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<u32>

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.
Source§

fn is_ms(&self) -> bool

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

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

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.
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_list(&self) -> bool

Check if the value is a list
Source§

fn as_slice(&self) -> Cow<'_, [Value]>

Get the value as a slice
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 for Param

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialEq<CURIE> for Param

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialEq<Param> for ParamCow<'_>

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

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

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Param

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Param

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<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl Freeze for Param

§

impl RefUnwindSafe for Param

§

impl Send for Param

§

impl Sync for Param

§

impl Unpin for Param

§

impl UnsafeUnpin 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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<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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more