Skip to main content

AnyLocalizationsDelegate

Trait AnyLocalizationsDelegate 

Source
pub trait AnyLocalizationsDelegate: Debug {
    // Required methods
    fn is_supported(&self, locale: &Locale) -> bool;
    fn load(
        &self,
        app: &mut App,
        locale: &Locale,
    ) -> CompleterFuture<Rc<dyn Any>> ⓘ;
    fn should_reload(&self, old: &dyn AnyLocalizationsDelegate) -> bool;
    fn type(&self) -> TypeId;
    fn runtime_type(&self) -> TypeId;
    fn as_any(&self) -> &dyn Any;
}
Expand description

The erased form of a LocalizationsDelegate: the delegate as a Localizations widget holds it, without its resource type.

Required Methods§

Source

fn is_supported(&self, locale: &Locale) -> bool

Source

fn load(&self, app: &mut App, locale: &Locale) -> CompleterFuture<Rc<dyn Any>> ⓘ

See LocalizationsDelegate::load; the value holds the Rc<T>.

Source

fn should_reload(&self, old: &dyn AnyLocalizationsDelegate) -> bool

See LocalizationsDelegate::should_reload; false when old is a delegate of another type.

Source

fn type(&self) -> TypeId

The type of the object returned by the load method, T by default.

This type is used to retrieve the object “loaded” by this LocalizationsDelegate from the Localizations inherited widget. For example the object loaded by LocalizationsDelegate<Foo> would be retrieved with:

Localizations::of::<Foo>(app, context)

It’s rarely necessary to override this getter.

Source

fn runtime_type(&self) -> TypeId

The delegate’s own type, Dart’s runtimeType.

Source

fn as_any(&self) -> &dyn Any

The delegate as Any, for should_reload.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§