pub struct Rotator { /* private fields */ }Expand description
Applies an EvictionPolicy to an AssetIndex + cache root.
Implementations§
Source§impl Rotator
impl Rotator
Sourcepub fn new(config: &ResolvedAssetConfig) -> Self
pub fn new(config: &ResolvedAssetConfig) -> Self
Build a rotator from a resolved config.
Sourcepub fn rotate(
&self,
index: &mut AssetIndex,
cache: &CacheManager,
) -> Result<RotationStats>
pub fn rotate( &self, index: &mut AssetIndex, cache: &CacheManager, ) -> Result<RotationStats>
Run a rotation pass in-place. Mutates the index and deletes files
from disk via the supplied CacheManager.
For EvictionPolicy::None this is a no-op.
Sourcepub fn within_budget(&self, index: &AssetIndex) -> bool
pub fn within_budget(&self, index: &AssetIndex) -> bool
Check whether the index is already within the configured budget.
This is an index-only check: it compares the total tracked size against the configured limit without touching the filesystem. A budget of 0 is treated as “unlimited”.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Rotator
impl RefUnwindSafe for Rotator
impl Send for Rotator
impl Sync for Rotator
impl Unpin for Rotator
impl UnsafeUnpin for Rotator
impl UnwindSafe for Rotator
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