pub struct ImageLoader { /* private fields */ }Expand description
Loads, decodes and caches images. A clone is the same loader;
image_loader is the one every rememberAsyncImage uses.
Implementations§
Source§impl ImageLoader
impl ImageLoader
Sourcepub fn new(limits: ImageCacheLimits, disk_dir: Option<PathBuf>) -> Self
pub fn new(limits: ImageCacheLimits, disk_dir: Option<PathBuf>) -> Self
A loader that keeps downloaded files in disk_dir, or none on disk
when it is None.
Sourcepub fn cached(&self, request: &ImageRequest) -> Option<ImageBitmap>
pub fn cached(&self, request: &ImageRequest) -> Option<ImageBitmap>
The decoded image when the memory cache holds it.
Sourcepub fn load(
&self,
client: HttpClientRef,
request: &ImageRequest,
) -> impl Future<Output = Result<ImageBitmap, ImageLoadError>> + use<>
pub fn load( &self, client: HttpClientRef, request: &ImageRequest, ) -> impl Future<Output = Result<ImageBitmap, ImageLoadError>> + use<>
Loads request, joining a load of the same request already under way.
The load stops when every future it returned is dropped.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ImageLoader
impl RefUnwindSafe for ImageLoader
impl Send for ImageLoader
impl Sync for ImageLoader
impl Unpin for ImageLoader
impl UnsafeUnpin for ImageLoader
impl UnwindSafe for ImageLoader
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
Mutably borrows from an owned value. Read more