pub enum ImageDecodeError {
Decode(ImageError),
TaskFailed(String),
}Expand description
Off-thread image decode: decode_image_async wraps
the existing synchronous ImageSource::decode in spawn_blocking, so it
composes with use_task for the full load/error/ready idiom without
ever blocking the UI thread on a decode. See image_async’s module docs
for why this lives in the facade rather than frust-widgets (which stays
reactive-free by charter) and for the Arc-move contract the decoded
ImageSource crosses threads under.
Off-thread image decode: decode_image_async wraps
the existing synchronous ImageSource::decode in spawn_blocking, so it
composes with use_task for the full load/error/ready idiom without
ever blocking the UI thread on a decode. See image_async’s module docs
for why this lives in the facade rather than frust-widgets (which stays
reactive-free by charter) and for the Arc-move contract the decoded
ImageSource crosses threads under.
Off-thread image decode: decode_image_async wraps
the existing synchronous ImageSource::decode in spawn_blocking, so it
composes with use_task for the full load/error/ready idiom without
ever blocking the UI thread on a decode. See image_async’s module docs
for why this lives in the facade rather than frust-widgets (which stays
reactive-free by charter) and for the Arc-move contract the decoded
ImageSource crosses threads under.
The error decode_image_async can fail with.
Two distinct failure modes, kept apart rather than collapsed into one
message: the synchronous decode itself can fail
(Decode, wrapping the existing
ImageError unchanged), or the background
spawn_blocking task can fail to run to completion at all
(TaskFailed — a panic inside the decode closure, or
the task being dropped/aborted before it finished; mirrors
tokio::task::JoinError’s own two cases). The join-failure text is kept
as a plain String here rather than naming tokio::task::JoinError
directly: frust has no direct dependency on tokio (only a
transitive one through frust-reactive), and this is the one place that
would otherwise need one just to name the type.
Variants§
Decode(ImageError)
ImageSource::decode ran to completion and reported a decode
failure (bad bytes, unsupported format, …).
TaskFailed(String)
The background decode task itself panicked or was cancelled before it could report a result.
Trait Implementations§
Source§impl Debug for ImageDecodeError
impl Debug for ImageDecodeError
Source§impl Display for ImageDecodeError
impl Display for ImageDecodeError
Source§impl Error for ImageDecodeError
impl Error for ImageDecodeError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for ImageDecodeError
impl !UnwindSafe for ImageDecodeError
impl Freeze for ImageDecodeError
impl Send for ImageDecodeError
impl Sync for ImageDecodeError
impl Unpin for ImageDecodeError
impl UnsafeUnpin for ImageDecodeError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.