[][src]Enum polyhorn_ios::assets::ImageSource

pub enum ImageSource {
    Placeholder(Size<f32>),
    Asset(ImageAsset),
    Bytes(Bytes),
}

An image source describes the source of an image that can be passed to e.g. the Image component. An image source can either be a placeholder, an Asset or a Bytes (3rd party crate) object.

Variants

Placeholder(Size<f32>)

If you're loading a remote image, you might want to show a placeholder instead. The placeholder is entirely transparent (unless you give the containing component an opaque background color) but does have a size. This size is subsequently used in calculating the layout.

The benefit of this is that when the image is eventually completely loaded and the component re-renders to show that image, the rest of the layout will not change because it already anticipated the correct size of the image.

Asset(ImageAsset)

This image source is backed by a local asset that is included in a Polyhorn package.

Bytes(Bytes)

This image source is backed by an PNG-encoded buffer.

Trait Implementations

impl Clone for ImageSource[src]

impl From<Bytes> for ImageSource[src]

impl From<ImageAsset> for ImageSource[src]

impl PartialEq<ImageSource> for ImageSource[src]

impl StructuralPartialEq for ImageSource[src]

Auto Trait Implementations

Blanket Implementations

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AsAny for T where
    T: Any
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> ConvertInto<U> for T where
    U: ConvertFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.