Trait csvenum::RTypeTrait
source · pub trait RTypeTrait {
// Required methods
fn from_typestr<T: AsRef<str>>(typestr: T) -> Result<Self, TypeError>
where Self: Sized;
fn to_typestr(&self) -> String;
fn to_typestr_no_ref(&self) -> String;
fn to_typestr_no_life(&self) -> String;
fn collect_lifetimes(&self, into: &mut Vec<String>);
fn get_depth(&self, counter: usize) -> usize;
fn get_breadth(&self, counter: usize) -> usize;
fn is_const(&self) -> bool;
fn value_is_valid(&self, valuestr: &str) -> bool;
fn wrap_valuestr(&self, valuestr: &str) -> String;
fn can_match_as_key(&self) -> bool;
}
Expand description
Trait to simplify handling types
Required Methods§
sourcefn from_typestr<T: AsRef<str>>(typestr: T) -> Result<Self, TypeError>where
Self: Sized,
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 “
-> will return RType::String(Reference::Naked, StringType::str)
sourcefn to_typestr(&self) -> String
fn to_typestr(&self) -> String
Conversions into type representation
Example input: &'a str
get normal representation &'a str
sourcefn to_typestr_no_ref(&self) -> String
fn to_typestr_no_ref(&self) -> String
get representation without references or lifetimes str
sourcefn to_typestr_no_life(&self) -> String
fn to_typestr_no_life(&self) -> String
get representation without lifetime &str
sourcefn collect_lifetimes(&self, into: &mut Vec<String>)
fn collect_lifetimes(&self, into: &mut Vec<String>)
collect lifetimes
sourcefn get_breadth(&self, counter: usize) -> usize
fn get_breadth(&self, counter: usize) -> usize
Get nesting breadth
sourcefn value_is_valid(&self, valuestr: &str) -> bool
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
)
Array|Vec in this case means that [2,3,4] is a valid declaration in text for array and vec tho vec can also have vec! prefixed
fn wrap_valuestr(&self, valuestr: &str) -> String
sourcefn can_match_as_key(&self) -> bool
fn can_match_as_key(&self) -> bool
Whether the type can be used as the key in a match expression, floats can not.