pub trait FluentType:
Debug
+ AnyEq
+ 'static {
// Required methods
fn duplicate(&self) -> Box<dyn FluentType + Send>;
fn as_string(&self, intls: &IntlLangMemoizer) -> Cow<'static, str>;
fn as_string_threadsafe(
&self,
intls: &IntlLangMemoizer,
) -> Cow<'static, str>;
}Expand description
Custom types can implement the FluentType trait in order to generate a string
value for use in the message generation process.
Required Methods§
Sourcefn duplicate(&self) -> Box<dyn FluentType + Send>
fn duplicate(&self) -> Box<dyn FluentType + Send>
Create a clone of the underlying type.
Sourcefn as_string(&self, intls: &IntlLangMemoizer) -> Cow<'static, str>
fn as_string(&self, intls: &IntlLangMemoizer) -> Cow<'static, str>
Convert the custom type into a string value, for instance a custom DateTime
type could return “Oct. 27, 2022”.
Sourcefn as_string_threadsafe(&self, intls: &IntlLangMemoizer) -> Cow<'static, str>
fn as_string_threadsafe(&self, intls: &IntlLangMemoizer) -> Cow<'static, str>
Convert the custom type into a string value, for instance a custom DateTime
type could return “Oct. 27, 2022”. This operation is provided the threadsafe
IntlLangMemoizer.
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".