Struct checkers::Events [−][src]
pub struct Events { /* fields omitted */ }
Expand description
Collections of events.
We use a wrapper type to provide convenience methods for diagnostics.
Implementations
Fetch all allocations as a slice.
Push a single event into the collection of events.
Examples
use checkers::{Event::*, Request, Events, Region};
let mut events = Events::new();
let request = Request::without_backtrace(Region::new(10.into(), 10, 1));
events.push(Alloc(request));
assert!(matches!(&events[0], &Alloc(..)));
Count the number of allocations in this collection of events.
Examples
use checkers::{Event::*, Request, Events, Event, Region};
let mut events = Events::new();
let request = Request::without_backtrace(Region::new(10.into(), 10, 1));
events.push(Alloc(request));
assert_eq!(1, events.allocs());
assert_eq!(0, events.frees());
Count the number of allocations in this collection of events.
Examples
use checkers::{Event::*, Request, Events, Region, Realloc};
let mut events = Events::new();
events.push(Realloc(Realloc::without_backtrace(
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());
Count the number of frees in this collection of events.
Examples
use checkers::{Event::*, Events, Region, Request};
let mut events = Events::new();
let request = Request::without_backtrace(Region::new(10.into(), 10, 1));
events.push(Free(request));
assert_eq!(0, events.allocs());
assert_eq!(1, events.frees());
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.
Max amount of memory used according to this event history.
Returns the first violation encountered if the history is not sound.
Examples
use checkers::{Event::*, Events, Region, Request};
let mut events = Events::new();
let request = Request::without_backtrace(Region::new(0x10.into(), 0x10, 1));
events.push(Alloc(request));
let request = Request::without_backtrace(Region::new(0x20.into(), 0x10, 1));
events.push(Alloc(request));
let request = Request::without_backtrace(Region::new(0x10.into(), 0x10, 1));
events.push(Free(request));
assert_eq!(0x20, events.max_memory_used().unwrap());
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Events
impl UnwindSafe for Events
Blanket Implementations
Mutably borrows from an owned value. Read more