Skip to main content

FluentLabel

Trait FluentLabel 

Source
pub trait FluentLabel {
    // Required method
    fn fluent_label_key() -> StaticFluentMessageKey;

    // Provided methods
    fn try_localize_label<L: FluentLocalizer + ?Sized>(
        localizer: &L,
    ) -> Option<String> { ... }
    fn localize_label<L: FluentLocalizer + ?Sized>(localizer: &L) -> String { ... }
}
Expand description

A trait for types that have a Fluent label key representing the type itself.

This trait is automatically implemented by #[derive(EsFluentLabel)] for source types, and by #[derive(EsFluentVariants)] for each generated variant enum.

Required Methods§

Source

fn fluent_label_key() -> StaticFluentMessageKey

Returns the fully scoped static key for this type-level label.

Provided Methods§

Source

fn try_localize_label<L: FluentLocalizer + ?Sized>( localizer: &L, ) -> Option<String>

Attempts to return the localized label for this type using an explicit localization context.

Source

fn localize_label<L: FluentLocalizer + ?Sized>(localizer: &L) -> String

Returns the localized label for this type using an explicit localization context.

A label key generated under the package-local fallback-str policy returns the labeled type’s snake_case Rust name.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§