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§
source§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> ) -> bool
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>
Trait Implementations§
source§impl<'s> Clone for FluentValue<'s>
impl<'s> Clone for FluentValue<'s>
source§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 moresource§impl<'source> Debug for FluentValue<'source>
impl<'source> Debug for FluentValue<'source>
source§impl From<&f32> for FluentValue<'_>
impl From<&f32> for FluentValue<'_>
source§fn from(n: &f32) -> FluentValue<'_>
fn from(n: &f32) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<&f64> for FluentValue<'_>
impl From<&f64> for FluentValue<'_>
source§fn from(n: &f64) -> FluentValue<'_>
fn from(n: &f64) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<&i128> for FluentValue<'_>
impl From<&i128> for FluentValue<'_>
source§fn from(n: &i128) -> FluentValue<'_>
fn from(n: &i128) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<&i16> for FluentValue<'_>
impl From<&i16> for FluentValue<'_>
source§fn from(n: &i16) -> FluentValue<'_>
fn from(n: &i16) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<&i32> for FluentValue<'_>
impl From<&i32> for FluentValue<'_>
source§fn from(n: &i32) -> FluentValue<'_>
fn from(n: &i32) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<&i64> for FluentValue<'_>
impl From<&i64> for FluentValue<'_>
source§fn from(n: &i64) -> FluentValue<'_>
fn from(n: &i64) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<&i8> for FluentValue<'_>
impl From<&i8> for FluentValue<'_>
source§fn from(n: &i8) -> FluentValue<'_>
fn from(n: &i8) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<&isize> for FluentValue<'_>
impl From<&isize> for FluentValue<'_>
source§fn from(n: &isize) -> FluentValue<'_>
fn from(n: &isize) -> FluentValue<'_>
Converts to this type from the input type.
source§impl<'source> From<&'source str> for FluentValue<'source>
impl<'source> From<&'source str> for FluentValue<'source>
source§fn from(s: &'source str) -> FluentValue<'source>
fn from(s: &'source str) -> FluentValue<'source>
Converts to this type from the input type.
source§impl From<&u128> for FluentValue<'_>
impl From<&u128> for FluentValue<'_>
source§fn from(n: &u128) -> FluentValue<'_>
fn from(n: &u128) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<&u16> for FluentValue<'_>
impl From<&u16> for FluentValue<'_>
source§fn from(n: &u16) -> FluentValue<'_>
fn from(n: &u16) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<&u32> for FluentValue<'_>
impl From<&u32> for FluentValue<'_>
source§fn from(n: &u32) -> FluentValue<'_>
fn from(n: &u32) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<&u64> for FluentValue<'_>
impl From<&u64> for FluentValue<'_>
source§fn from(n: &u64) -> FluentValue<'_>
fn from(n: &u64) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<&u8> for FluentValue<'_>
impl From<&u8> for FluentValue<'_>
source§fn from(n: &u8) -> FluentValue<'_>
fn from(n: &u8) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<&usize> for FluentValue<'_>
impl From<&usize> for FluentValue<'_>
source§fn from(n: &usize) -> FluentValue<'_>
fn from(n: &usize) -> FluentValue<'_>
Converts to this type from the input type.
source§impl<'l> From<FluentNumber> for FluentValue<'l>
impl<'l> From<FluentNumber> for FluentValue<'l>
source§fn from(input: FluentNumber) -> FluentValue<'l>
fn from(input: FluentNumber) -> FluentValue<'l>
Converts to this type from the input type.
source§impl<'source> From<String> for FluentValue<'source>
impl<'source> From<String> for FluentValue<'source>
source§fn from(s: String) -> FluentValue<'source>
fn from(s: String) -> FluentValue<'source>
Converts to this type from the input type.
source§impl From<f32> for FluentValue<'_>
impl From<f32> for FluentValue<'_>
source§fn from(n: f32) -> FluentValue<'_>
fn from(n: f32) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<f64> for FluentValue<'_>
impl From<f64> for FluentValue<'_>
source§fn from(n: f64) -> FluentValue<'_>
fn from(n: f64) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<i128> for FluentValue<'_>
impl From<i128> for FluentValue<'_>
source§fn from(n: i128) -> FluentValue<'_>
fn from(n: i128) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<i16> for FluentValue<'_>
impl From<i16> for FluentValue<'_>
source§fn from(n: i16) -> FluentValue<'_>
fn from(n: i16) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<i32> for FluentValue<'_>
impl From<i32> for FluentValue<'_>
source§fn from(n: i32) -> FluentValue<'_>
fn from(n: i32) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<i64> for FluentValue<'_>
impl From<i64> for FluentValue<'_>
source§fn from(n: i64) -> FluentValue<'_>
fn from(n: i64) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<i8> for FluentValue<'_>
impl From<i8> for FluentValue<'_>
source§fn from(n: i8) -> FluentValue<'_>
fn from(n: i8) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<isize> for FluentValue<'_>
impl From<isize> for FluentValue<'_>
source§fn from(n: isize) -> FluentValue<'_>
fn from(n: isize) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<u128> for FluentValue<'_>
impl From<u128> for FluentValue<'_>
source§fn from(n: u128) -> FluentValue<'_>
fn from(n: u128) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<u16> for FluentValue<'_>
impl From<u16> for FluentValue<'_>
source§fn from(n: u16) -> FluentValue<'_>
fn from(n: u16) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<u32> for FluentValue<'_>
impl From<u32> for FluentValue<'_>
source§fn from(n: u32) -> FluentValue<'_>
fn from(n: u32) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<u64> for FluentValue<'_>
impl From<u64> for FluentValue<'_>
source§fn from(n: u64) -> FluentValue<'_>
fn from(n: u64) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<u8> for FluentValue<'_>
impl From<u8> for FluentValue<'_>
source§fn from(n: u8) -> FluentValue<'_>
fn from(n: u8) -> FluentValue<'_>
Converts to this type from the input type.
source§impl From<usize> for FluentValue<'_>
impl From<usize> for FluentValue<'_>
source§fn from(n: usize) -> FluentValue<'_>
fn from(n: usize) -> FluentValue<'_>
Converts to this type from the input type.
source§impl<'s> PartialEq for FluentValue<'s>
impl<'s> PartialEq for FluentValue<'s>
source§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> !DynSend for FluentValue<'source>
impl<'source> !DynSync for FluentValue<'source>
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§
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> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Creates a filterable data provider with the given name for debugging. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
T: 'static,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 120 bytes
Size for each variant:
String
: 32 bytesNumber
: 120 bytesCustom
: 24 bytesNone
: 0 bytesError
: 0 bytes