Skip to main content

StyledImage

Trait StyledImage 

Source
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§

Source

fn image_style(&mut self) -> &mut ImageStyle

Get a mutable ImageStyle from the element.

Provided Methods§

Source

fn grayscale(self, grayscale: bool) -> Self

Set the image to be displayed in grayscale.

Source

fn object_fit(self, object_fit: ObjectFit) -> Self

Set the object fit for the image.

Source

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.

Source

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".

Implementors§