pub struct Message { /* private fields */ }Expand description
A static message definition emitted by tr! or generated catalog bindings.
Implementations§
Source§impl Message
impl Message
Sourcepub const fn new(
namespace: &'static str,
id: &'static str,
source: &'static SourceCatalog,
) -> Message
pub const fn new( namespace: &'static str, id: &'static str, source: &'static SourceCatalog, ) -> Message
Defines a message using a source catalog containing id.
Prefer the macros, which validate the source at compile time.
Sourcepub fn namespace(&self) -> &'static str
pub fn namespace(&self) -> &'static str
The package namespace used for catalog lookup and app overrides.
Sourcepub fn format_source(
&self,
arguments: &[Argument<'_>],
) -> Result<String, LocalizationError>
pub fn format_source( &self, arguments: &[Argument<'_>], ) -> Result<String, LocalizationError>
Formats the source-language message without any application catalog.
Sourcepub fn fallback_text(&self, arguments: &[Argument<'_>]) -> String
pub fn fallback_text(&self, arguments: &[Argument<'_>]) -> String
Returns best-effort source text after a formatting error, preserving readable text and Fluent’s unresolved-variable markers instead of showing a catalog key.
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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