Skip to main content

FluentMessage

Trait FluentMessage 

Source
pub trait FluentMessage {
    // Required method
    fn to_fluent_string_with(
        &self,
        localize: &mut dyn for<'a> FnMut(&str, &str, Option<&HashMap<&str, FluentValue<'a>>>) -> String,
    ) -> 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 dyn for<'a> FnMut(&str, &str, Option<&HashMap<&str, FluentValue<'a>>>) -> String, ) -> 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.

Implementations on Foreign Types§

Source§

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

Source§

fn to_fluent_string_with( &self, localize: &mut dyn for<'a> FnMut(&str, &str, Option<&HashMap<&str, FluentValue<'a>>>) -> String, ) -> String

Implementors§