pub struct ThumbhashImage<'a, 'h> { /* private fields */ }
Expand description

A widget that displays a thumbhash while the actual image is loading.

Implementations§

source§

impl<'a, 'h> ThumbhashImage<'a, 'h>

source

pub fn new(image: Image<'a>, thumbhash: &'h [u8]) -> Self

Create a new ThumbhashImage widget. You should pass a Image with the configuration you want. Since the width of the egui Image is currently a bit finicky, you can use Image::fit_to_exact_size to make sure the image is the size you want.

source

pub fn id(self, id: Id) -> Self

Set a unique id for this widget, used for the fade animation. By default, the thumbhash data is used as the id.

source

pub fn fade(self, fade: bool) -> Self

Set whether the image should fade in when it’s loaded. Defaults to true.

source

pub fn fit_to_exact_size(self, size: Vec2) -> Self

Set the exact size the image should be shown at. This will override the size of the image widget.

source

pub fn rounding(self, rounding: impl Into<Rounding>) -> Self

Set the rounding of the image. Use this instead of Image::rounding to make sure the rounding is applied to the thumbhash image as well.

source

pub fn ui(self, ui: &mut Ui) -> Response

Show the image.

Trait Implementations§

source§

impl<'a, 'h> Widget for ThumbhashImage<'a, 'h>

source§

fn ui(self, ui: &mut Ui) -> Response

Allocate space, interact, paint, and return a Response. Read more

Auto Trait Implementations§

§

impl<'a, 'h> Freeze for ThumbhashImage<'a, 'h>

§

impl<'a, 'h> RefUnwindSafe for ThumbhashImage<'a, 'h>

§

impl<'a, 'h> Send for ThumbhashImage<'a, 'h>

§

impl<'a, 'h> Sync for ThumbhashImage<'a, 'h>

§

impl<'a, 'h> Unpin for ThumbhashImage<'a, 'h>

§

impl<'a, 'h> UnwindSafe for ThumbhashImage<'a, 'h>

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