pub enum Type {
String,
Number,
Path,
Bool,
List(Box<Type>, char),
}Expand description
Available types that can be converted to a Value
Uses for configure subjects and properties types to validate it after parsing.
let raw_value = "3".to_string();
let kind = Type::Number;
let value = kind.try_cast( raw_value )?;
assert_eq!( Value::Number( 3.0 ), value );In the above example, the Type enum is used to represent the expected type of the value for a property. The Number type is chosen, and the raw value is parsed and validated to ensure it matches this type.
Variants§
String
String
Number
Number
Path
Path
Bool
Bool
List(Box<Type>, char)
List of some type values separated a delimiter character
Trait Implementations§
source§impl PartialEq for Type
impl PartialEq for Type
impl Eq for Type
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl Freeze for Type
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnwindSafe for Type
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<S> SetWithType for S
impl<S> SetWithType for S
source§fn set_with_type<T, IntoT>(&mut self, component: IntoT)where
IntoT: Into<T>,
S: SetComponent<T, IntoT>,
fn set_with_type<T, IntoT>(&mut self, component: IntoT)where
IntoT: Into<T>,
S: SetComponent<T, IntoT>,
Function to set value of a component by its type.