pub struct MemoryPressureManager {
pub budget_mb: f32,
pub used_mb: f32,
pub eviction_policy: EvictionPolicy,
pub lru_order: VecDeque<u64>,
pub access_counts: HashMap<u64, u64>,
pub pressure_threshold: f32,
pub critical_threshold: f32,
}Fields§
§budget_mb: f32§used_mb: f32§eviction_policy: EvictionPolicy§lru_order: VecDeque<u64>§access_counts: HashMap<u64, u64>§pressure_threshold: f32§critical_threshold: f32Implementations§
Source§impl MemoryPressureManager
impl MemoryPressureManager
pub fn new(budget_mb: f32) -> Self
pub fn is_under_pressure(&self) -> bool
pub fn is_critical(&self) -> bool
pub fn available_mb(&self) -> f32
pub fn can_load(&self, size_mb: f32) -> bool
pub fn record_access(&mut self, level_id: u64)
pub fn record_load(&mut self, level_id: u64, size_mb: f32)
pub fn record_unload(&mut self, level_id: u64, size_mb: f32)
pub fn select_eviction_candidates( &self, needed_mb: f32, levels: &[StreamingLevel], ) -> Vec<u64>
pub fn pressure_ratio(&self) -> f32
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MemoryPressureManager
impl RefUnwindSafe for MemoryPressureManager
impl Send for MemoryPressureManager
impl Sync for MemoryPressureManager
impl Unpin for MemoryPressureManager
impl UnsafeUnpin for MemoryPressureManager
impl UnwindSafe for MemoryPressureManager
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.