Skip to main content

FluentMessage

Trait FluentMessage 

Source
pub trait FluentMessage {
    // Required method
    fn to_fluent_string_with(
        &self,
        localize: &mut FluentMessageLookup<'_>,
    ) -> String;
}
Expand description

A typed Fluent message that can be resolved by an explicit localization backend.

Derive macros implement this trait for #[derive(EsFluent)] and generated variant enums. Runtime managers use it to keep typed message call sites while routing lookup through a request, component, or application-scoped manager.

Required Methods§

Source

fn to_fluent_string_with( &self, localize: &mut FluentMessageLookup<'_>, ) -> String

Converts the message into a localized string using the supplied lookup callback.

Manual implementations should treat localize as the only lookup path during rendering. Do not re-enter the same localizer to select a language or perform other lock-taking lookups from this method; managers may hold snapshot locks while invoking it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: FluentMessage + ?Sized> FluentMessage for &T

Source§

fn to_fluent_string_with( &self, localize: &mut FluentMessageLookup<'_>, ) -> String

Implementors§