Enum cgats::DataPoint

source ·
pub enum DataPoint {
    Alpha(String),
    Float(f32),
    Int(i32),
}
Expand description

The building block of CGATS data

Variants§

§

Alpha(String)

String type

§

Float(f32)

Float type

§

Int(i32)

Integer type

Implementations§

source§

impl DataPoint

source

pub fn new_alpha<S: ToString>(alpha: S) -> Self

Create a new string type

source

pub fn new_float<F: Into<f32>>(float: F) -> Self

Create a new float type

source

pub fn new_int<I: Into<i32>>(int: I) -> Self

Create a new integer type

source

pub fn to_int(&self) -> Result<Self>

Convert to integer type

source

pub fn to_float(&self) -> Result<Self>

Convert to float type

source

pub fn to_float_unchecked(&self) -> f32

Extract the float value. Panics if the type cannot be converted to a Float.

source

pub fn to_alpha(&self) -> Self

Convert to string type

Trait Implementations§

source§

impl AsRef<DataPoint> for DataPoint

source§

fn as_ref(&self) -> &Self

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

impl CgatsFmt for DataPoint

source§

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

Format data to a fmt::Formatter
source§

impl Clone for DataPoint

source§

fn clone(&self) -> DataPoint

Returns a copy 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 DataPoint

source§

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

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

impl Display for DataPoint

source§

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

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

impl FromStr for DataPoint

§

type Err = Box<dyn Error, Global>

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self>

Parses a string s to return a value of this type. Read more
source§

impl PartialAdd<DataPoint> for DataPoint

§

type Output = DataPoint

The output of a successfull add
source§

fn partial_add(&self, rhs: &Self) -> Option<Self::Output>

Try to add the two values
source§

impl PartialDiv<usize> for DataPoint

§

type Output = DataPoint

The output of a successful division
source§

fn partial_div(&self, rhs: &usize) -> Option<Self::Output>

Divides the values. Returns None if either value is not a type that can divide.
source§

impl PartialEq<&str> for DataPoint

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<DataPoint> for &str

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<DataPoint> for DataPoint

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<DataPoint> for f32

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<DataPoint> for i32

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<DataPoint> for str

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<String> for DataPoint

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<f32> for DataPoint

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<i32> for DataPoint

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<str> for DataPoint

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<DataPoint> for DataPoint

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Eq for DataPoint

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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<'a, T> PartialSum<'a, T> for Twhere T: 'a + Clone + PartialAdd<T, Output = T>,

source§

fn partial_sum<I>(iter: I) -> Option<<T as PartialAdd<T>>::Output>where I: IntoIterator<Item = &'a T>,

Try to sum the values in the iterator
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

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

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

§

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 Twhere U: TryFrom<T>,

§

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.