pub struct LruImageCache { /* private fields */ }Expand description
按显存/内存字节预算自动淘汰最久未用条目的 LRU 图像缓存。
Implementations§
Source§impl LruImageCache
impl LruImageCache
pub fn new(max_bytes: usize) -> Self
pub fn current_bytes(&self) -> usize
pub fn max_bytes(&self) -> usize
pub fn set_max_bytes(&mut self, max_bytes: usize)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn insert(&mut self, id: ImageAssetId, pixels: DecodedPixels)
pub fn get(&mut self, id: ImageAssetId) -> Option<DecodedPixels>
pub fn remove(&mut self, id: ImageAssetId) -> bool
pub fn clear(&mut self)
Auto Trait Implementations§
impl Forget for LruImageCache
impl Freeze for LruImageCache
impl Move for LruImageCache
impl RefUnwindSafe for LruImageCache
impl Send for LruImageCache
impl Sync for LruImageCache
impl Unpin for LruImageCache
impl UnsafeUnpin for LruImageCache
impl UnwindSafe for LruImageCache
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FluentBuilder for T
impl<T> FluentBuilder for T
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
当
condition 为 true 时执行闭包修饰自身,否则原样返回。Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Self
fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self
根据
condition 在两个修饰分支之间二选一。Source§fn when_some<O>(
self,
option: Option<O>,
then: impl FnOnce(Self, O) -> Self,
) -> Self
fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self
当
option 为 Some(value) 时执行闭包修饰自身,否则原样返回。