Enum tel::Description
source · pub enum Description {
Null,
StringValue {
value: String,
},
NumberValue {
value: f64,
},
BooleanValue {
value: bool,
},
Object {
value: HashMap<String, Description>,
},
ExactArray {
value: Vec<Description>,
},
Array {
item_type: Box<Description>,
},
BaseType {
field_type: String,
},
Union {
of: Vec<Description>,
},
Error {
error: TelError,
},
Unknown,
Any,
}Variants§
Null
StringValue
NumberValue
BooleanValue
Object
Fields
§
value: HashMap<String, Description>ExactArray
Fields
§
value: Vec<Description>Array
Fields
§
item_type: Box<Description>BaseType
Union
Fields
§
of: Vec<Description>Error
Unknown
Any
Implementations§
source§impl Description
impl Description
pub fn new_string(value: String) -> Description
pub fn new_number(value: f64) -> Description
pub fn new_error(error: TelError) -> Description
pub fn new_base_type(field_type: &str) -> Description
pub fn to_form_string(&self) -> String
pub fn optional(&self) -> Description
pub fn new_union(descriptions: Vec<Description>) -> Description
pub fn map<M>(&self, m: M) -> Description
pub fn get_type(&self) -> String
sourcepub fn as_index(&self) -> Result<usize, Option<TelError>>
pub fn as_index(&self) -> Result<usize, Option<TelError>>
Converts a description into potential index
If the description is a valid index, it will return the index. Otherwise it will return an error or an empty option if it could be potentially a valid index but it could not be determined.
sourcepub fn as_slice(&self) -> Vec<SelectorDescription>
pub fn as_slice(&self) -> Vec<SelectorDescription>
Converts a description into potential slice
Like numbers[0] or headers[“Content-Type”]
If the description is a valid slice, it will return the slice part. Otherwise it will return an error or unknown if it could be potentially a valid slice but it could not be determined.
pub fn to_string(&self) -> Description
pub fn to_boolean(&self) -> Description
sourcepub fn to_base(&self) -> Description
pub fn to_base(&self) -> Description
Converts a description to its base type.
Base types are the most generic types that can be used to describe a value without an actual value.
Trait Implementations§
source§impl Clone for Description
impl Clone for Description
source§fn clone(&self) -> Description
fn clone(&self) -> Description
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for Description
impl Debug for Description
source§impl<'de> Deserialize<'de> for Description
impl<'de> Deserialize<'de> for Description
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for Description
impl PartialEq for Description
source§fn eq(&self, other: &Description) -> bool
fn eq(&self, other: &Description) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl Serialize for Description
impl Serialize for Description
impl StructuralPartialEq for Description
Auto Trait Implementations§
impl RefUnwindSafe for Description
impl Send for Description
impl Sync for Description
impl Unpin for Description
impl UnwindSafe for Description
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