pub struct LiteralValue {
pub value: Value,
pub lemma_type: LemmaType,
}Expand description
A literal value with its type
Every literal value knows its type - no distinction between standard and custom types.
Fields§
§value: Value§lemma_type: LemmaTypeImplementations§
Source§impl LiteralValue
impl LiteralValue
Sourcepub fn number<T: Into<Decimal>>(value: T) -> Self
pub fn number<T: Into<Decimal>>(value: T) -> Self
Create a Number literal value from any type that can convert to Decimal Uses STANDARD_NUMBER as the type
Sourcepub fn number_with_type<T: Into<Decimal>>(
value: T,
lemma_type: LemmaType,
) -> Self
pub fn number_with_type<T: Into<Decimal>>( value: T, lemma_type: LemmaType, ) -> Self
Create a Number literal value with a custom type
Sourcepub fn scale<T: Into<Decimal>>(value: T, unit: Option<String>) -> Self
pub fn scale<T: Into<Decimal>>(value: T, unit: Option<String>) -> Self
Create a Scale literal value Uses the provided type (must be a Scale type)
Sourcepub fn scale_with_type<T: Into<Decimal>>(
value: T,
unit: Option<String>,
lemma_type: LemmaType,
) -> Self
pub fn scale_with_type<T: Into<Decimal>>( value: T, unit: Option<String>, lemma_type: LemmaType, ) -> Self
Create a Scale literal value with a custom type
Sourcepub fn text_with_type(value: String, lemma_type: LemmaType) -> Self
pub fn text_with_type(value: String, lemma_type: LemmaType) -> Self
Create a Text literal value with a custom type
Sourcepub fn boolean(value: BooleanValue) -> Self
pub fn boolean(value: BooleanValue) -> Self
Create a Boolean literal value Uses STANDARD_BOOLEAN as the type
Sourcepub fn boolean_with_type(value: BooleanValue, lemma_type: LemmaType) -> Self
pub fn boolean_with_type(value: BooleanValue, lemma_type: LemmaType) -> Self
Create a Boolean literal value with a custom type
Sourcepub fn date(value: DateTimeValue) -> Self
pub fn date(value: DateTimeValue) -> Self
Create a Date literal value Uses STANDARD_DATE as the type
Sourcepub fn date_with_type(value: DateTimeValue, lemma_type: LemmaType) -> Self
pub fn date_with_type(value: DateTimeValue, lemma_type: LemmaType) -> Self
Create a Date literal value with a custom type
Sourcepub fn time(value: TimeValue) -> Self
pub fn time(value: TimeValue) -> Self
Create a Time literal value Uses STANDARD_TIME as the type
Sourcepub fn time_with_type(value: TimeValue, lemma_type: LemmaType) -> Self
pub fn time_with_type(value: TimeValue, lemma_type: LemmaType) -> Self
Create a Time literal value with a custom type
Sourcepub fn duration(value: Decimal, unit: DurationUnit) -> Self
pub fn duration(value: Decimal, unit: DurationUnit) -> Self
Create a Duration literal value Uses STANDARD_DURATION as the type
Sourcepub fn duration_with_type(
value: Decimal,
unit: DurationUnit,
lemma_type: LemmaType,
) -> Self
pub fn duration_with_type( value: Decimal, unit: DurationUnit, lemma_type: LemmaType, ) -> Self
Create a Duration literal value with a custom type
Sourcepub fn ratio<T: Into<Decimal>>(value: T, unit: Option<String>) -> Self
pub fn ratio<T: Into<Decimal>>(value: T, unit: Option<String>) -> Self
Create a Ratio literal value Uses STANDARD_RATIO as the type
Sourcepub fn ratio_with_type<T: Into<Decimal>>(
value: T,
unit: Option<String>,
lemma_type: LemmaType,
) -> Self
pub fn ratio_with_type<T: Into<Decimal>>( value: T, unit: Option<String>, lemma_type: LemmaType, ) -> Self
Create a Ratio literal value with a custom type
Sourcepub fn display_value(&self) -> String
pub fn display_value(&self) -> String
Get the display value as a string (uses the Display implementation)
Trait Implementations§
Source§impl Clone for LiteralValue
impl Clone for LiteralValue
Source§fn clone(&self) -> LiteralValue
fn clone(&self) -> LiteralValue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LiteralValue
impl Debug for LiteralValue
Source§impl<'de> Deserialize<'de> for LiteralValue
impl<'de> Deserialize<'de> for LiteralValue
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 Display for LiteralValue
impl Display for LiteralValue
Source§impl PartialEq for LiteralValue
impl PartialEq for LiteralValue
Source§impl Serialize for LiteralValue
impl Serialize for LiteralValue
impl StructuralPartialEq for LiteralValue
Auto Trait Implementations§
impl Freeze for LiteralValue
impl RefUnwindSafe for LiteralValue
impl Send for LiteralValue
impl Sync for LiteralValue
impl Unpin for LiteralValue
impl UnwindSafe for LiteralValue
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