pub enum ImageSource {
Resource(Resource),
Render(Arc<RenderImage>),
Image(Arc<Image>),
Custom(Arc<dyn Fn(&mut Window, &mut App) -> Option<Result<Arc<RenderImage>, ImageCacheError>>>),
}Expand description
A source of image content.
Variants§
Resource(Resource)
The image content will be loaded from some resource location
Render(Arc<RenderImage>)
Cached image data
Image(Arc<Image>)
Cached image data
Custom(Arc<dyn Fn(&mut Window, &mut App) -> Option<Result<Arc<RenderImage>, ImageCacheError>>>)
A custom loading function to use
Implementations§
Source§impl ImageSource
impl ImageSource
Sourcepub fn remove_asset(&self, cx: &mut App)
pub fn remove_asset(&self, cx: &mut App)
Remove this image source from the asset system
Sourcepub fn cached(&self, cx: &App) -> Option<Arc<RenderImage>>
pub fn cached(&self, cx: &App) -> Option<Arc<RenderImage>>
vue-native fork: the decode the asset system holds for this source, if its load has finished. Never starts a load.
Sourcepub fn replace_cached(&self, image: Arc<RenderImage>, cx: &mut App) -> bool
pub fn replace_cached(&self, image: Arc<RenderImage>, cx: &mut App) -> bool
vue-native fork: makes image what the asset system answers for this
source from now on — a smaller copy of the decode
(RenderImage::with_natural_size), or the full decode back. false
when the source is still loading, or is not one the asset system caches.
Sourcepub fn load_detached(
&self,
cx: &mut App,
) -> Option<Task<Result<Arc<RenderImage>, ImageCacheError>>>
pub fn load_detached( &self, cx: &mut App, ) -> Option<Task<Result<Arc<RenderImage>, ImageCacheError>>>
vue-native fork: loads and decodes this source afresh on the background
executor, leaving the asset system’s entry as it is (an embedder that
swapped in a smaller copy gets the full decode back this way without
the element going blank meanwhile). None for a source the asset
system does not load.
Trait Implementations§
Source§impl Clone for ImageSource
impl Clone for ImageSource
Source§impl<'a> From<&'a str> for ImageSource
impl<'a> From<&'a str> for ImageSource
Source§impl From<&Path> for ImageSource
impl From<&Path> for ImageSource
Source§impl From<Arc<RenderImage>> for ImageSource
impl From<Arc<RenderImage>> for ImageSource
Source§fn from(value: Arc<RenderImage>) -> Self
fn from(value: Arc<RenderImage>) -> Self
Source§impl<F> From<F> for ImageSource
impl<F> From<F> for ImageSource
Source§impl From<PathBuf> for ImageSource
impl From<PathBuf> for ImageSource
Source§fn from(s: SharedString) -> Self
fn from(s: SharedString) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for ImageSource
impl !Send for ImageSource
impl !Sync for ImageSource
impl !UnwindSafe for ImageSource
impl Forget for ImageSource
impl Freeze for ImageSource
impl Move for ImageSource
impl Unpin for ImageSource
impl UnsafeUnpin for ImageSource
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more