Struct tauri::image::Image

source ·
pub struct Image<'a> { /* private fields */ }
Expand description

An RGBA Image in row-major order from top to bottom.

Implementations§

source§

impl Image<'static>

source

pub const fn new_owned(rgba: Vec<u8>, width: u32, height: u32) -> Self

Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height.

Similar to Self::new but avoids cloning the rgba data to get an owned Image.

source§

impl<'a> Image<'a>

source

pub const fn new(rgba: &'a [u8], width: u32, height: u32) -> Self

Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height.

source

pub fn from_bytes(bytes: &[u8]) -> Result<Self>

Available on crate features image-ico or image-png only.

Creates a new image using the provided bytes.

Only ico and png are supported (based on activated feature flag).

source

pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self>

Available on crate features image-ico or image-png only.

Creates a new image using the provided path.

Only ico and png are supported (based on activated feature flag).

source

pub fn rgba(&'a self) -> &'a [u8]

Returns the RGBA data for this image, in row-major order from top to bottom.

source

pub fn width(&self) -> u32

Returns the width of this image.

source

pub fn height(&self) -> u32

Returns the height of this image.

source

pub fn to_owned(self) -> Image<'static>

Convert into a ’static owned Image. This will allocate.

Trait Implementations§

source§

impl<'a> Clone for Image<'a>

source§

fn clone(&self) -> Image<'a>

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<'a> Debug for Image<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

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

source§

fn from(img: Image<'a>) -> Self

Converts to this type from the input type.
source§

impl Resource for Image<'static>

source§

fn name(&self) -> Cow<'_, str>

Returns a string representation of the resource. The default implementation returns the Rust type name, but specific resource types may override this trait method.
source§

fn close(self: Arc<Self>)

Resources may implement the close() trait method if they need to do resource specific clean-ups, such as cancelling pending futures, after a resource has been removed from the resource table.
source§

impl TryFrom<Image<'_>> for Icon

§

type Error = Error

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

fn try_from(img: Image<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Image<'_>> for Icon

§

type Error = Error

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

fn try_from(img: Image<'_>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<'a> Freeze for Image<'a>

§

impl<'a> RefUnwindSafe for Image<'a>

§

impl<'a> Send for Image<'a>

§

impl<'a> Sync for Image<'a>

§

impl<'a> Unpin for Image<'a>

§

impl<'a> UnwindSafe for Image<'a>

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> 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> 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> UserEvent for T
where T: Debug + Clone + Send + 'static,