[−][src]Struct checkers::Events
A fixed-size collection of allocations.
Methods
impl Events
[src]
pub const fn new() -> Self
[src]
Construct a new collection of allocations.
pub fn len(&self) -> usize
[src]
Get the number of events in this collection.
pub fn is_empty(&self) -> bool
[src]
Test if collection is empty.
pub fn capacity(&self) -> usize
[src]
Access the capacity of the Events container.
pub fn reserve(&mut self, cap: usize)
[src]
Reserve extra capacity for the underlying storage.
pub fn as_slice(&self) -> &[Event]
[src]
Fetch all allocations as a slice.
pub fn as_slice_mut(&mut self) -> &mut [Event]
[src]
Fetch all allocations as a slice.
pub fn clear(&mut self)
[src]
Clear the collection of events.
pub fn push(&mut self, event: Event)
[src]
Push a single event into the collection of events.
Examples
use checkers::{Events, Event, Region}; let mut events = Events::new(); let event = Event::Alloc(Region::new(10.into(), 10, 1)); events.push(event); assert_eq!(event, events[0]);
pub fn allocs(&self) -> usize
[src]
Count the number of allocations in this collection of events.
Examples
use checkers::{Events, Event, Region}; let mut events = Events::new(); events.push(Event::Alloc(Region::new(10.into(), 10, 1))); assert_eq!(1, events.allocs()); assert_eq!(0, events.frees());
pub fn reallocs(&self) -> usize
[src]
Count the number of allocations in this collection of events.
Examples
use checkers::{Events, Event, Region, Realloc}; let mut events = Events::new(); events.push(Event::Realloc(Realloc::new( Some(true), Region::new(10.into(), 10, 1), Region::new(20.into(), 10, 1) ))); assert_eq!(1, events.reallocs()); assert_eq!(0, events.allocs()); assert_eq!(0, events.frees());
pub fn frees(&self) -> usize
[src]
Count the number of frees in this collection of events.
Examples
use checkers::{Events, Event, Region}; let mut events = Events::new(); events.push(Event::Free(Region::new(10.into(), 10, 1))); assert_eq!(0, events.allocs()); assert_eq!(1, events.frees());
pub fn validate(&self, errors: &mut Vec<Violation>)
[src]
Validate the current state and populate the errors collection with any violations found.
See Machine::push for more details on the kind of validation errors that can be raised.
pub fn max_memory_used(&self) -> Result<usize, Violation>
[src]
Max amount of memory used according to this event history.
Returns the first violation encountered if the history is not sound.
Examples
use checkers::{Events, Event, Region}; let mut events = Events::new(); events.push(Event::Alloc(Region::new(0x10.into(), 0x10, 1))); events.push(Event::Alloc(Region::new(0x20.into(), 0x10, 1))); events.push(Event::Free(Region::new(0x10.into(), 0x10, 1))); assert_eq!(Ok(0x20), events.max_memory_used());
Trait Implementations
impl Clone for Events
[src]
impl Debug for Events
[src]
impl Deref for Events
[src]
impl DerefMut for Events
[src]
impl<I: SliceIndex<[Event]>> Index<I> for Events
[src]
Auto Trait Implementations
impl RefUnwindSafe for Events
impl Send for Events
impl Sync for Events
impl Unpin for Events
impl UnwindSafe for Events
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>,