pub trait StyledImage: Sized {
// Required method
fn image_style(&mut self) -> &mut ImageStyle;
// Provided methods
fn grayscale(self, grayscale: bool) -> Self { ... }
fn object_fit(self, object_fit: ObjectFit) -> Self { ... }
fn with_fallback(self, fallback: impl Fn() -> AnyElement + 'static) -> Self { ... }
fn with_loading(self, loading: impl Fn() -> AnyElement + 'static) -> Self { ... }
}Expand description
Style an image element.
Required Methods§
Sourcefn image_style(&mut self) -> &mut ImageStyle
fn image_style(&mut self) -> &mut ImageStyle
Get a mutable ImageStyle from the element.
Provided Methods§
Sourcefn object_fit(self, object_fit: ObjectFit) -> Self
fn object_fit(self, object_fit: ObjectFit) -> Self
Set the object fit for the image.
Sourcefn with_fallback(self, fallback: impl Fn() -> AnyElement + 'static) -> Self
fn with_fallback(self, fallback: impl Fn() -> AnyElement + 'static) -> Self
Set a fallback function that will be invoked to render an error view should the image fail to load.
Sourcefn with_loading(self, loading: impl Fn() -> AnyElement + 'static) -> Self
fn with_loading(self, loading: impl Fn() -> AnyElement + 'static) -> Self
Set a fallback function that will be invoked to render a view while the image is still being loaded.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".