pub enum Literal {
Null,
Integer(i64),
Float(f64),
Boolean(bool),
String(String),
RawString(String),
Date(String),
Time(String),
Timestamp(String),
ValueAndUnit(ValueAndUnit),
}
Variants§
Null
Integer(i64)
Float(f64)
Boolean(bool)
String(String)
RawString(String)
Date(String)
Time(String)
Timestamp(String)
ValueAndUnit(ValueAndUnit)
Implementations§
Source§impl Literal
impl Literal
Sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Returns true if this is a Literal::Integer
, otherwise false
Sourcepub fn as_integer_mut(&mut self) -> Option<&mut i64>
pub fn as_integer_mut(&mut self) -> Option<&mut i64>
Optionally returns mutable references to the inner fields if this is a Literal::Integer
, otherwise None
Sourcepub fn as_integer(&self) -> Option<&i64>
pub fn as_integer(&self) -> Option<&i64>
Optionally returns references to the inner fields if this is a Literal::Integer
, otherwise None
Sourcepub fn into_integer(self) -> Result<i64, Self>
pub fn into_integer(self) -> Result<i64, Self>
Returns the inner fields if this is a Literal::Integer
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn as_float_mut(&mut self) -> Option<&mut f64>
pub fn as_float_mut(&mut self) -> Option<&mut f64>
Optionally returns mutable references to the inner fields if this is a Literal::Float
, otherwise None
Sourcepub fn as_float(&self) -> Option<&f64>
pub fn as_float(&self) -> Option<&f64>
Optionally returns references to the inner fields if this is a Literal::Float
, otherwise None
Sourcepub fn into_float(self) -> Result<f64, Self>
pub fn into_float(self) -> Result<f64, Self>
Returns the inner fields if this is a Literal::Float
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn is_boolean(&self) -> bool
pub fn is_boolean(&self) -> bool
Returns true if this is a Literal::Boolean
, otherwise false
Sourcepub fn as_boolean_mut(&mut self) -> Option<&mut bool>
pub fn as_boolean_mut(&mut self) -> Option<&mut bool>
Optionally returns mutable references to the inner fields if this is a Literal::Boolean
, otherwise None
Sourcepub fn as_boolean(&self) -> Option<&bool>
pub fn as_boolean(&self) -> Option<&bool>
Optionally returns references to the inner fields if this is a Literal::Boolean
, otherwise None
Sourcepub fn into_boolean(self) -> Result<bool, Self>
pub fn into_boolean(self) -> Result<bool, Self>
Returns the inner fields if this is a Literal::Boolean
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn as_string_mut(&mut self) -> Option<&mut String>
pub fn as_string_mut(&mut self) -> Option<&mut String>
Optionally returns mutable references to the inner fields if this is a Literal::String
, otherwise None
Sourcepub fn as_string(&self) -> Option<&String>
pub fn as_string(&self) -> Option<&String>
Optionally returns references to the inner fields if this is a Literal::String
, otherwise None
Sourcepub fn into_string(self) -> Result<String, Self>
pub fn into_string(self) -> Result<String, Self>
Returns the inner fields if this is a Literal::String
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn is_raw_string(&self) -> bool
pub fn is_raw_string(&self) -> bool
Returns true if this is a Literal::RawString
, otherwise false
Sourcepub fn as_raw_string_mut(&mut self) -> Option<&mut String>
pub fn as_raw_string_mut(&mut self) -> Option<&mut String>
Optionally returns mutable references to the inner fields if this is a Literal::RawString
, otherwise None
Sourcepub fn as_raw_string(&self) -> Option<&String>
pub fn as_raw_string(&self) -> Option<&String>
Optionally returns references to the inner fields if this is a Literal::RawString
, otherwise None
Sourcepub fn into_raw_string(self) -> Result<String, Self>
pub fn into_raw_string(self) -> Result<String, Self>
Returns the inner fields if this is a Literal::RawString
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn as_date_mut(&mut self) -> Option<&mut String>
pub fn as_date_mut(&mut self) -> Option<&mut String>
Optionally returns mutable references to the inner fields if this is a Literal::Date
, otherwise None
Sourcepub fn as_date(&self) -> Option<&String>
pub fn as_date(&self) -> Option<&String>
Optionally returns references to the inner fields if this is a Literal::Date
, otherwise None
Sourcepub fn into_date(self) -> Result<String, Self>
pub fn into_date(self) -> Result<String, Self>
Returns the inner fields if this is a Literal::Date
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn as_time_mut(&mut self) -> Option<&mut String>
pub fn as_time_mut(&mut self) -> Option<&mut String>
Optionally returns mutable references to the inner fields if this is a Literal::Time
, otherwise None
Sourcepub fn as_time(&self) -> Option<&String>
pub fn as_time(&self) -> Option<&String>
Optionally returns references to the inner fields if this is a Literal::Time
, otherwise None
Sourcepub fn into_time(self) -> Result<String, Self>
pub fn into_time(self) -> Result<String, Self>
Returns the inner fields if this is a Literal::Time
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn is_timestamp(&self) -> bool
pub fn is_timestamp(&self) -> bool
Returns true if this is a Literal::Timestamp
, otherwise false
Sourcepub fn as_timestamp_mut(&mut self) -> Option<&mut String>
pub fn as_timestamp_mut(&mut self) -> Option<&mut String>
Optionally returns mutable references to the inner fields if this is a Literal::Timestamp
, otherwise None
Sourcepub fn as_timestamp(&self) -> Option<&String>
pub fn as_timestamp(&self) -> Option<&String>
Optionally returns references to the inner fields if this is a Literal::Timestamp
, otherwise None
Sourcepub fn into_timestamp(self) -> Result<String, Self>
pub fn into_timestamp(self) -> Result<String, Self>
Returns the inner fields if this is a Literal::Timestamp
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn is_value_and_unit(&self) -> bool
pub fn is_value_and_unit(&self) -> bool
Returns true if this is a Literal::ValueAndUnit
, otherwise false
Sourcepub fn as_value_and_unit_mut(&mut self) -> Option<&mut ValueAndUnit>
pub fn as_value_and_unit_mut(&mut self) -> Option<&mut ValueAndUnit>
Optionally returns mutable references to the inner fields if this is a Literal::ValueAndUnit
, otherwise None
Sourcepub fn as_value_and_unit(&self) -> Option<&ValueAndUnit>
pub fn as_value_and_unit(&self) -> Option<&ValueAndUnit>
Optionally returns references to the inner fields if this is a Literal::ValueAndUnit
, otherwise None
Sourcepub fn into_value_and_unit(self) -> Result<ValueAndUnit, Self>
pub fn into_value_and_unit(self) -> Result<ValueAndUnit, Self>
Returns the inner fields if this is a Literal::ValueAndUnit
, otherwise returns back the enum in the Err
case of the result
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Literal
impl<'de> Deserialize<'de> for Literal
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>,
Source§impl JsonSchema for Literal
impl JsonSchema for Literal
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref
keyword. Read moreimpl StructuralPartialEq for Literal
Auto Trait Implementations§
impl Freeze for Literal
impl RefUnwindSafe for Literal
impl Send for Literal
impl Sync for Literal
impl Unpin for Literal
impl UnwindSafe for Literal
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more