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§
Sourcefn fluent_label_key() -> StaticFluentMessageKey
fn fluent_label_key() -> StaticFluentMessageKey
Returns the fully scoped static key for this type-level label.
Provided Methods§
Sourcefn try_localize_label<L: FluentLocalizer + ?Sized>(
localizer: &L,
) -> Option<String>
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.
Sourcefn localize_label<L: FluentLocalizer + ?Sized>(localizer: &L) -> String
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".