[−][src]Struct memflow::mem::cache::count_validator::CountCacheValidator
Validator for limiting the cache time based on a time Instant
Remarks
This validator is only available when being compiled with std
.
When using no_std
you might want to use another validator.
TODO: add other validators here
Implementations
impl CountCacheValidator
[src]
pub fn new(valid_count: usize) -> Self
[src]
Creates a new CountCacheValidator with a customizable valid count.
Valid count is increased on every memory operation by the validator users.
Examples:
use memflow::mem::CountCacheValidator; use memflow::CacheValidator; let mut validator = CountCacheValidator::new(100); validator.allocate_slots(1); assert!(!validator.is_slot_valid(0)); validator.validate_slot(0); // For a hundred times the slot should stay valid for _ in 0..100 { assert!(validator.is_slot_valid(0)); validator.update_validity(); } // At this point it should become invalid assert!(!validator.is_slot_valid(0));
Trait Implementations
impl CacheValidator for CountCacheValidator
[src]
fn allocate_slots(&mut self, slot_count: usize)
[src]
fn update_validity(&mut self)
[src]
fn is_slot_valid(&self, slot_id: usize) -> bool
[src]
fn validate_slot(&mut self, slot_id: usize)
[src]
fn invalidate_slot(&mut self, slot_id: usize)
[src]
impl Clone for CountCacheValidator
[src]
fn clone(&self) -> CountCacheValidator
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Default for CountCacheValidator
[src]
Creates a validator with a cache timeout of 1 second.
Auto Trait Implementations
impl RefUnwindSafe for CountCacheValidator
impl Send for CountCacheValidator
impl Sync for CountCacheValidator
impl Unpin for CountCacheValidator
impl UnwindSafe for CountCacheValidator
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,