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,
) -> Self
pub const fn new( namespace: &'static str, id: &'static str, source: &'static SourceCatalog, ) -> Self
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