pub struct ImageCache { /* private fields */ }Expand description
A session-scoped cache of decoded images.
Owned by whatever is rendering or extracting, passed down by &mut — no
global state, no interior mutability.
Implementations§
Source§impl ImageCache
impl ImageCache
Sourcepub fn get(
&mut self,
key: ObjRef,
size: RequestedSize,
) -> Option<Arc<ImageData>>
pub fn get( &mut self, key: ObjRef, size: RequestedSize, ) -> Option<Arc<ImageData>>
Look an image up, refreshing its recency.
Three rungs: the exact key, then a full-resolution entry — which serves anything — then any entry whose decoded dimensions already cover the request in both axes. The third matters because a decoder is free to ignore the hint: an image asked for at 600x600 that came back at 5000x5000 is stored under the 600x600 request, and a later 300x300 request must find it rather than decode the same codestream again.
Trait Implementations§
Source§impl Debug for ImageCache
impl Debug for ImageCache
Source§impl Default for ImageCache
impl Default for ImageCache
Source§fn default() -> ImageCache
fn default() -> ImageCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ImageCache
impl RefUnwindSafe for ImageCache
impl Send for ImageCache
impl Sync for ImageCache
impl Unpin for ImageCache
impl UnsafeUnpin for ImageCache
impl UnwindSafe for ImageCache
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