[][src]Enum fluent_bundle::types::FluentValue

pub enum FluentValue<'source> {
    String(Cow<'source, str>),
    Number(FluentNumber),
    Custom(Box<dyn FluentType + Send>),
    Error(DisplayableNode<'source>),
    None,
}

The FluentValue enum represents values which can be formatted to a String.

The ResolveValue trait from the resolve module evaluates AST nodes into FluentValues which can then be formatted to Strings using the i18n formatters stored by the FluentBundle instance if required.

The arguments HashMap passed to FluentBundle::format should also use FluentValues as values of arguments.

Variants

String(Cow<'source, str>)
Number(FluentNumber)
Custom(Box<dyn FluentType + Send>)
Error(DisplayableNode<'source>)
None

Methods

impl<'source> FluentValue<'source>[src]

pub fn try_number<S: ToString>(v: S) -> Self[src]

pub fn matches<R: Borrow<FluentResource>, M: MemoizerKind>(
    &self,
    other: &FluentValue,
    scope: &Scope<R, M>
) -> bool
[src]

pub fn as_string<R: Borrow<FluentResource>, M: MemoizerKind>(
    &self,
    scope: &Scope<R, M>
) -> Cow<'source, str>
[src]

Trait Implementations

impl<'s> Clone for FluentValue<'s>[src]

impl<'source> Debug for FluentValue<'source>[src]

impl<'_, '_> From<&'_ f32> for FluentValue<'_>[src]

impl<'_, '_> From<&'_ f64> for FluentValue<'_>[src]

impl<'_, '_> From<&'_ i128> for FluentValue<'_>[src]

impl<'_, '_> From<&'_ i16> for FluentValue<'_>[src]

impl<'_, '_> From<&'_ i32> for FluentValue<'_>[src]

impl<'_, '_> From<&'_ i64> for FluentValue<'_>[src]

impl<'_, '_> From<&'_ i8> for FluentValue<'_>[src]

impl<'_, '_> From<&'_ isize> for FluentValue<'_>[src]

impl<'_, '_> From<&'_ u128> for FluentValue<'_>[src]

impl<'_, '_> From<&'_ u16> for FluentValue<'_>[src]

impl<'_, '_> From<&'_ u32> for FluentValue<'_>[src]

impl<'_, '_> From<&'_ u64> for FluentValue<'_>[src]

impl<'_, '_> From<&'_ u8> for FluentValue<'_>[src]

impl<'_, '_> From<&'_ usize> for FluentValue<'_>[src]

impl<'source> From<&'source str> for FluentValue<'source>[src]

impl<'source> From<Cow<'source, str>> for FluentValue<'source>[src]

impl<'l> From<FluentNumber> for FluentValue<'l>[src]

impl<'source> From<String> for FluentValue<'source>[src]

impl<'_> From<f32> for FluentValue<'_>[src]

impl<'_> From<f64> for FluentValue<'_>[src]

impl<'_> From<i128> for FluentValue<'_>[src]

impl<'_> From<i16> for FluentValue<'_>[src]

impl<'_> From<i32> for FluentValue<'_>[src]

impl<'_> From<i64> for FluentValue<'_>[src]

impl<'_> From<i8> for FluentValue<'_>[src]

impl<'_> From<isize> for FluentValue<'_>[src]

impl<'_> From<u128> for FluentValue<'_>[src]

impl<'_> From<u16> for FluentValue<'_>[src]

impl<'_> From<u32> for FluentValue<'_>[src]

impl<'_> From<u64> for FluentValue<'_>[src]

impl<'_> From<u8> for FluentValue<'_>[src]

impl<'_> From<usize> for FluentValue<'_>[src]

impl<'s> PartialEq<FluentValue<'s>> for FluentValue<'s>[src]

Auto Trait Implementations

impl<'source> !RefUnwindSafe for FluentValue<'source>

impl<'source> Send for FluentValue<'source>

impl<'source> !Sync for FluentValue<'source>

impl<'source> Unpin for FluentValue<'source>

impl<'source> !UnwindSafe for FluentValue<'source>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AnyEq for T where
    T: PartialEq<T> + Any
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.