pub enum FluentValue<'source> {
String(Cow<'source, str>),
Number(FluentNumber),
Custom(Box<dyn FluentType + Send>),
None,
Error,
}
Expand description
The FluentValue
enum represents values which can be formatted to a String.
Those values are either passed as arguments to FluentBundle::format_pattern
or
produced by functions, or generated in the process of pattern resolution.
Variants§
Implementations§
§impl<'source> FluentValue<'source>
impl<'source> FluentValue<'source>
pub fn try_number<S>(v: S) -> FluentValue<'source>where
S: ToString,
pub fn matches<R, M>(
&self,
other: &FluentValue<'_>,
scope: &Scope<'_, '_, R, M>,
) -> boolwhere
R: Borrow<FluentResource>,
M: MemoizerKind,
pub fn write<W, R, M>( &self, w: &mut W, scope: &Scope<'_, '_, R, M>, ) -> Result<(), Error>
pub fn as_string<R, M>(&self, scope: &Scope<'_, '_, R, M>) -> Cow<'source, str>where
R: Borrow<FluentResource>,
M: MemoizerKind,
Trait Implementations§
§impl<'s> Clone for FluentValue<'s>
impl<'s> Clone for FluentValue<'s>
§fn clone(&self) -> FluentValue<'s>
fn clone(&self) -> FluentValue<'s>
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 more§impl<'source> Debug for FluentValue<'source>
impl<'source> Debug for FluentValue<'source>
§impl<'source> From<&'source String> for FluentValue<'source>
impl<'source> From<&'source String> for FluentValue<'source>
§fn from(s: &'source String) -> FluentValue<'source>
fn from(s: &'source String) -> FluentValue<'source>
Converts to this type from the input type.
§impl From<&f32> for FluentValue<'_>
impl From<&f32> for FluentValue<'_>
§fn from(n: &f32) -> FluentValue<'_>
fn from(n: &f32) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<&f64> for FluentValue<'_>
impl From<&f64> for FluentValue<'_>
§fn from(n: &f64) -> FluentValue<'_>
fn from(n: &f64) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<&i128> for FluentValue<'_>
impl From<&i128> for FluentValue<'_>
§fn from(n: &i128) -> FluentValue<'_>
fn from(n: &i128) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<&i16> for FluentValue<'_>
impl From<&i16> for FluentValue<'_>
§fn from(n: &i16) -> FluentValue<'_>
fn from(n: &i16) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<&i32> for FluentValue<'_>
impl From<&i32> for FluentValue<'_>
§fn from(n: &i32) -> FluentValue<'_>
fn from(n: &i32) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<&i64> for FluentValue<'_>
impl From<&i64> for FluentValue<'_>
§fn from(n: &i64) -> FluentValue<'_>
fn from(n: &i64) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<&i8> for FluentValue<'_>
impl From<&i8> for FluentValue<'_>
§fn from(n: &i8) -> FluentValue<'_>
fn from(n: &i8) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<&isize> for FluentValue<'_>
impl From<&isize> for FluentValue<'_>
§fn from(n: &isize) -> FluentValue<'_>
fn from(n: &isize) -> FluentValue<'_>
Converts to this type from the input type.
§impl<'source> From<&'source str> for FluentValue<'source>
impl<'source> From<&'source str> for FluentValue<'source>
§fn from(s: &'source str) -> FluentValue<'source>
fn from(s: &'source str) -> FluentValue<'source>
Converts to this type from the input type.
§impl From<&u128> for FluentValue<'_>
impl From<&u128> for FluentValue<'_>
§fn from(n: &u128) -> FluentValue<'_>
fn from(n: &u128) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<&u16> for FluentValue<'_>
impl From<&u16> for FluentValue<'_>
§fn from(n: &u16) -> FluentValue<'_>
fn from(n: &u16) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<&u32> for FluentValue<'_>
impl From<&u32> for FluentValue<'_>
§fn from(n: &u32) -> FluentValue<'_>
fn from(n: &u32) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<&u64> for FluentValue<'_>
impl From<&u64> for FluentValue<'_>
§fn from(n: &u64) -> FluentValue<'_>
fn from(n: &u64) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<&u8> for FluentValue<'_>
impl From<&u8> for FluentValue<'_>
§fn from(n: &u8) -> FluentValue<'_>
fn from(n: &u8) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<&usize> for FluentValue<'_>
impl From<&usize> for FluentValue<'_>
§fn from(n: &usize) -> FluentValue<'_>
fn from(n: &usize) -> FluentValue<'_>
Converts to this type from the input type.
§impl<'source> From<Cow<'source, str>> for FluentValue<'source>
impl<'source> From<Cow<'source, str>> for FluentValue<'source>
§fn from(s: Cow<'source, str>) -> FluentValue<'source>
fn from(s: Cow<'source, str>) -> FluentValue<'source>
Converts to this type from the input type.
§impl<'l> From<FluentNumber> for FluentValue<'l>
impl<'l> From<FluentNumber> for FluentValue<'l>
§fn from(input: FluentNumber) -> FluentValue<'l>
fn from(input: FluentNumber) -> FluentValue<'l>
Converts to this type from the input type.
§impl<'source> From<String> for FluentValue<'source>
impl<'source> From<String> for FluentValue<'source>
§fn from(s: String) -> FluentValue<'source>
fn from(s: String) -> FluentValue<'source>
Converts to this type from the input type.
§impl From<f32> for FluentValue<'_>
impl From<f32> for FluentValue<'_>
§fn from(n: f32) -> FluentValue<'_>
fn from(n: f32) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<f64> for FluentValue<'_>
impl From<f64> for FluentValue<'_>
§fn from(n: f64) -> FluentValue<'_>
fn from(n: f64) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<i128> for FluentValue<'_>
impl From<i128> for FluentValue<'_>
§fn from(n: i128) -> FluentValue<'_>
fn from(n: i128) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<i16> for FluentValue<'_>
impl From<i16> for FluentValue<'_>
§fn from(n: i16) -> FluentValue<'_>
fn from(n: i16) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<i32> for FluentValue<'_>
impl From<i32> for FluentValue<'_>
§fn from(n: i32) -> FluentValue<'_>
fn from(n: i32) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<i64> for FluentValue<'_>
impl From<i64> for FluentValue<'_>
§fn from(n: i64) -> FluentValue<'_>
fn from(n: i64) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<i8> for FluentValue<'_>
impl From<i8> for FluentValue<'_>
§fn from(n: i8) -> FluentValue<'_>
fn from(n: i8) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<isize> for FluentValue<'_>
impl From<isize> for FluentValue<'_>
§fn from(n: isize) -> FluentValue<'_>
fn from(n: isize) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<u128> for FluentValue<'_>
impl From<u128> for FluentValue<'_>
§fn from(n: u128) -> FluentValue<'_>
fn from(n: u128) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<u16> for FluentValue<'_>
impl From<u16> for FluentValue<'_>
§fn from(n: u16) -> FluentValue<'_>
fn from(n: u16) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<u32> for FluentValue<'_>
impl From<u32> for FluentValue<'_>
§fn from(n: u32) -> FluentValue<'_>
fn from(n: u32) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<u64> for FluentValue<'_>
impl From<u64> for FluentValue<'_>
§fn from(n: u64) -> FluentValue<'_>
fn from(n: u64) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<u8> for FluentValue<'_>
impl From<u8> for FluentValue<'_>
§fn from(n: u8) -> FluentValue<'_>
fn from(n: u8) -> FluentValue<'_>
Converts to this type from the input type.
§impl From<usize> for FluentValue<'_>
impl From<usize> for FluentValue<'_>
§fn from(n: usize) -> FluentValue<'_>
fn from(n: usize) -> FluentValue<'_>
Converts to this type from the input type.
§impl<'s> PartialEq for FluentValue<'s>
impl<'s> PartialEq for FluentValue<'s>
§fn eq(&self, other: &FluentValue<'s>) -> bool
fn eq(&self, other: &FluentValue<'s>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.Auto Trait Implementations§
impl<'source> Freeze for FluentValue<'source>
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> AnyEq for T
impl<T> AnyEq for T
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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