Enum csvenum::SpecialType

source ·
pub enum SpecialType {
    Enum(String),
    Regex,
    Bool,
}
Expand description

Special types have vastly different behaviour than the other types and can not be directly inferred from a string representation (except for bool).

Variants§

§

Enum(String)

§

Regex

§

Bool

When a property is of type singular bool then collect all variants with true and false as const array and return as Vec in match function

Trait Implementations§

source§

impl Debug for SpecialType

source§

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

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

impl PartialEq for SpecialType

source§

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

source§

fn is_const(&self) -> bool

Not applicable to enum since enums const be decalred as const or static, but as enum MyEnum {…}

Regex require OnceLock so they are definitely not const

source§

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

For enums, values are variants, so the Rust syntax rules for Enum variants apply, it could also have the name of the enum prefixed

For Regex, values are r““ that contain weird characters, so take anything as valid i guess… but when get_or_init’ing the OnceLock handle the except with a generated error message

source§

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

Construct the RType from a string that contains type information i.e. “ &str “ Read more
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 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 SpecialType

source§

impl StructuralPartialEq for SpecialType

Auto Trait Implementations§

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, 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.