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 unsafe fn into_integer_unchecked(self) -> i64
pub unsafe fn into_integer_unchecked(self) -> i64
Unchecked return of the inner fields of Literal::Integer.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_integer_unchecked(&self) -> &i64
pub unsafe fn as_integer_unchecked(&self) -> &i64
Unchecked reference of the inner fields of Literal::Integer.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_integer_mut_unchecked(&mut self) -> &mut i64
pub unsafe fn as_integer_mut_unchecked(&mut self) -> &mut i64
Unchecked mutable reference of the inner fields of Literal::Integer.
§Safety
Results in undefined behavior when it is the incorrect variant.
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 unsafe fn into_float_unchecked(self) -> f64
pub unsafe fn into_float_unchecked(self) -> f64
Unchecked return of the inner fields of Literal::Float.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_float_unchecked(&self) -> &f64
pub unsafe fn as_float_unchecked(&self) -> &f64
Unchecked reference of the inner fields of Literal::Float.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_float_mut_unchecked(&mut self) -> &mut f64
pub unsafe fn as_float_mut_unchecked(&mut self) -> &mut f64
Unchecked mutable reference of the inner fields of Literal::Float.
§Safety
Results in undefined behavior when it is the incorrect variant.
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 unsafe fn into_boolean_unchecked(self) -> bool
pub unsafe fn into_boolean_unchecked(self) -> bool
Unchecked return of the inner fields of Literal::Boolean.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_boolean_unchecked(&self) -> &bool
pub unsafe fn as_boolean_unchecked(&self) -> &bool
Unchecked reference of the inner fields of Literal::Boolean.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_boolean_mut_unchecked(&mut self) -> &mut bool
pub unsafe fn as_boolean_mut_unchecked(&mut self) -> &mut bool
Unchecked mutable reference of the inner fields of Literal::Boolean.
§Safety
Results in undefined behavior when it is the incorrect variant.
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 unsafe fn into_string_unchecked(self) -> String
pub unsafe fn into_string_unchecked(self) -> String
Unchecked return of the inner fields of Literal::String.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_string_unchecked(&self) -> &String
pub unsafe fn as_string_unchecked(&self) -> &String
Unchecked reference of the inner fields of Literal::String.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_string_mut_unchecked(&mut self) -> &mut String
pub unsafe fn as_string_mut_unchecked(&mut self) -> &mut String
Unchecked mutable reference of the inner fields of Literal::String.
§Safety
Results in undefined behavior when it is the incorrect variant.
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 unsafe fn into_raw_string_unchecked(self) -> String
pub unsafe fn into_raw_string_unchecked(self) -> String
Unchecked return of the inner fields of Literal::RawString.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_raw_string_unchecked(&self) -> &String
pub unsafe fn as_raw_string_unchecked(&self) -> &String
Unchecked reference of the inner fields of Literal::RawString.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_raw_string_mut_unchecked(&mut self) -> &mut String
pub unsafe fn as_raw_string_mut_unchecked(&mut self) -> &mut String
Unchecked mutable reference of the inner fields of Literal::RawString.
§Safety
Results in undefined behavior when it is the incorrect variant.
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 unsafe fn into_date_unchecked(self) -> String
pub unsafe fn into_date_unchecked(self) -> String
Unchecked return of the inner fields of Literal::Date.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_date_unchecked(&self) -> &String
pub unsafe fn as_date_unchecked(&self) -> &String
Unchecked reference of the inner fields of Literal::Date.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_date_mut_unchecked(&mut self) -> &mut String
pub unsafe fn as_date_mut_unchecked(&mut self) -> &mut String
Unchecked mutable reference of the inner fields of Literal::Date.
§Safety
Results in undefined behavior when it is the incorrect variant.
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 unsafe fn into_time_unchecked(self) -> String
pub unsafe fn into_time_unchecked(self) -> String
Unchecked return of the inner fields of Literal::Time.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_time_unchecked(&self) -> &String
pub unsafe fn as_time_unchecked(&self) -> &String
Unchecked reference of the inner fields of Literal::Time.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_time_mut_unchecked(&mut self) -> &mut String
pub unsafe fn as_time_mut_unchecked(&mut self) -> &mut String
Unchecked mutable reference of the inner fields of Literal::Time.
§Safety
Results in undefined behavior when it is the incorrect variant.
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 unsafe fn into_timestamp_unchecked(self) -> String
pub unsafe fn into_timestamp_unchecked(self) -> String
Unchecked return of the inner fields of Literal::Timestamp.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_timestamp_unchecked(&self) -> &String
pub unsafe fn as_timestamp_unchecked(&self) -> &String
Unchecked reference of the inner fields of Literal::Timestamp.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_timestamp_mut_unchecked(&mut self) -> &mut String
pub unsafe fn as_timestamp_mut_unchecked(&mut self) -> &mut String
Unchecked mutable reference of the inner fields of Literal::Timestamp.
§Safety
Results in undefined behavior when it is the incorrect variant.
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
Sourcepub unsafe fn into_value_and_unit_unchecked(self) -> ValueAndUnit
pub unsafe fn into_value_and_unit_unchecked(self) -> ValueAndUnit
Unchecked return of the inner fields of Literal::ValueAndUnit.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_value_and_unit_unchecked(&self) -> &ValueAndUnit
pub unsafe fn as_value_and_unit_unchecked(&self) -> &ValueAndUnit
Unchecked reference of the inner fields of Literal::ValueAndUnit.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_value_and_unit_mut_unchecked(&mut self) -> &mut ValueAndUnit
pub unsafe fn as_value_and_unit_mut_unchecked(&mut self) -> &mut ValueAndUnit
Unchecked mutable reference of the inner fields of Literal::ValueAndUnit.
§Safety
Results in undefined behavior when it is the incorrect variant.
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 UnsafeUnpin 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 moreSource§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
WrappingSpan::make_wrapped to wrap an AST node in a span.