Enum csvenum::RType

source ·
pub enum RType {
    Numeric(Reference, NumericType),
    String(Reference, StringType),
    Container(Reference, ContainerType),
    Special(Reference, SpecialType),
}
Expand description

Rust Type primitive (no value or name attached, except for enum), has functions for:

  • constructing itself from a given string that should contain type information.

  • validation of values.

  • gathering of information (can be const, has lifetimes, etc.).

  • formatting passed values.

Its variants contain the actual type and an optional Reference

Numeric -> NumericType

String -> StringType

Container -> ContainerType

Special -> SpecialType

Variants§

§

Numeric(Reference, NumericType)

Any Numeric Type

§

String(Reference, StringType)

Any String Type

§

Container(Reference, ContainerType)

Any Container Type, except for Option and Result

§

Special(Reference, SpecialType)

Special Types that need special treatment, very special incl:

Regex

Enum

Bool (not that special actually but easy to find)

Implementations§

source§

impl RType

source

pub fn get_refstr(&self) -> String

source

pub fn get_refstr_no_life(&self) -> String

source

pub fn get_lifetime(&self) -> String

source

pub fn has_lifetime(&self) -> bool

Trait Implementations§

source§

impl Debug for RType

source§

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

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

impl Display for RType

source§

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

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

impl PartialEq for RType

source§

fn eq(&self, other: &RType) -> 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 RTypeTrait for RType

source§

fn from_typestr<T: AsRef<str>>(typestr: T) -> Result<Self, TypeError>
where Self: Sized,

Call this function to parse the complete type information from a string representation

source§

fn is_const(&self) -> bool

Container of type tuple will not be const when it contains non-const types

source§

fn to_typestr(&self) -> String

Conversions into type representation Read more
source§

fn to_typestr_no_ref(&self) -> String

get representation without references or lifetimes str
source§

fn to_typestr_no_life(&self) -> String

get representation without lifetime &str
source§

fn collect_lifetimes(&self, into: &mut Vec<String>)

collect lifetimes
source§

fn value_is_valid(&self, valuestr: &str) -> bool

Value is valid - assume an input of (2,2,[2,3,4]) -> Tuple(NumType,NumType,Array|Vec) Read more
source§

fn get_depth(&self, counter: usize) -> usize

Get nesting depth
source§

fn get_breadth(&self, counter: usize) -> usize

Get nesting breadth
source§

fn wrap_valuestr(&self, valuestr: &str) -> String

source§

fn can_match_as_key(&self) -> bool

Whether the type can be used as the key in a match expression, floats can not.
source§

impl Eq for RType

source§

impl StructuralPartialEq for RType

Auto Trait Implementations§

§

impl Freeze for RType

§

impl RefUnwindSafe for RType

§

impl Send for RType

§

impl Sync for RType

§

impl Unpin for RType

§

impl UnwindSafe for RType

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> 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> ToString for T
where 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 T
where 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 T
where 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.