Enum show_image::Image

source ·
pub enum Image {
    Box(BoxImage),
    Arc(ArcImage),
    BoxDyn(Box<dyn AsImageView + Send>),
    ArcDyn(Arc<dyn AsImageView + Sync + Send>),
    Invalid(ImageDataError),
}
Expand description

Owning image that can be sent to another thread.

The image is backed by either a Box or Arc. It can either directly own the data or through a [dyn AsImageView].

Variants§

§

Box(BoxImage)

An image backed by a Box<[u8]>.

§

Arc(ArcImage)

An image backed by an Arc<[u8]>.

§

BoxDyn(Box<dyn AsImageView + Send>)

An image backed by a Box<dyn AsImageView>.

§

ArcDyn(Arc<dyn AsImageView + Sync + Send>)

An image backed by an Arc<dyn AsImageView>.

§

Invalid(ImageDataError)

An invalid image that will always fail the conversion to ImageView.

Implementations§

source§

impl Image

source

pub fn as_image_view(&self) -> Result<ImageView<'_>, ImageDataError>

Get a non-owning view of the image data.

Trait Implementations§

source§

impl AsImageView for Image

source§

fn as_image_view(&self) -> Result<ImageView<'_>, ImageDataError>

Get an image view for the object.
source§

impl Clone for Image

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl From<&DrawTarget> for Image

Available on crate feature raqote only.
source§

fn from(other: &DrawTarget) -> Self

Converts to this type from the input type.
source§

impl From<&ImageView<'_>> for Image

source§

fn from(other: &ImageView<'_>) -> Self

Converts to this type from the input type.
source§

impl<T> From<Arc<T>> for Image
where T: AsImageView + Send + Sync + 'static,

source§

fn from(other: Arc<T>) -> Self

Converts to this type from the input type.
source§

impl From<Arc<dyn AsImageView + Sync + Send>> for Image

source§

fn from(other: Arc<dyn AsImageView + Sync + Send>) -> Self

Converts to this type from the input type.
source§

impl From<ArcImage> for Image

source§

fn from(other: ArcImage) -> Self

Converts to this type from the input type.
source§

impl<T> From<Box<T>> for Image
where T: AsImageView + Send + 'static,

source§

fn from(other: Box<T>) -> Self

Converts to this type from the input type.
source§

impl From<Box<dyn AsImageView + Send>> for Image

source§

fn from(other: Box<dyn AsImageView + Send>) -> Self

Converts to this type from the input type.
source§

impl From<BoxImage> for Image

source§

fn from(other: BoxImage) -> Self

Converts to this type from the input type.
source§

impl From<DrawTarget> for Image

Available on crate feature raqote only.
source§

fn from(other: DrawTarget) -> Self

Converts to this type from the input type.
source§

impl From<DynamicImage> for Image

Available on crate feature image only.
source§

fn from(other: DynamicImage) -> Self

Converts to this type from the input type.
source§

impl From<Image<'_>> for Image

Available on crate feature raqote only.
source§

fn from(other: Image<'_>) -> Self

Converts to this type from the input type.
source§

impl<P, Container> From<ImageBuffer<P, Container>> for Image
where P: Pixel<Subpixel = u8> + PixelWithColorType, Container: Deref<Target = [u8]>,

Available on crate feature image only.
source§

fn from(other: ImageBuffer<P, Container>) -> Self

Converts to this type from the input type.
source§

impl From<ImageView<'_>> for Image

source§

fn from(other: ImageView<'_>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Result<TensorImage<'a>, ImageDataError>> for Image

Available on crate feature tch only.
source§

fn from(other: Result<TensorImage<'a>, ImageDataError>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<TensorImage<'a>> for Image

Available on crate feature tch only.
source§

fn from(other: TensorImage<'a>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Image

§

impl !RefUnwindSafe for Image

§

impl Send for Image

§

impl !Sync for Image

§

impl Unpin for Image

§

impl !UnwindSafe for Image

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Downcast<T> for T

source§

fn downcast(&self) -> &T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Upcast<T> for T

source§

fn upcast(&self) -> Option<&T>

source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WasmNotSend for T
where T: Send,