[−][src]Struct checkers::Machine
Fake machine implementation to validate an allocation history.
Methods
impl Machine
[src]
pub fn push(&mut self, event: Event) -> Result<(), PushError>
[src]
Push an event into the machine.
Examples
Checks for a double-free:
use checkers::{Event, Machine}; let mut machine = Machine::default(); assert!(machine.push(Event::Allocation { ptr: 0.into(), size: 2, align: 1, }).is_ok()); assert!(machine.push(Event::Deallocation { ptr: 0.into(), size: 2, align: 1, }).is_ok()); assert!(machine.push(Event::Deallocation { ptr: 0.into(), size: 2, align: 1, }).is_err());
Checks for a misaligned allocation:
use checkers::{Event, Machine}; let mut machine = Machine::default(); assert!(machine.push(Event::Allocation { ptr: 5.into(), size: 2, align: 4, }).is_err());
Tries to deallocate part of other region:
use checkers::{Event, Machine}; let mut machine = Machine::default(); assert!(machine.push(Event::Allocation { ptr: 100.into(), size: 100, align: 1, }).is_ok()); assert!(machine.push(Event::Deallocation { ptr: 150.into(), size: 50, align: 1, }).is_err()); assert!(machine.push(Event::Deallocation { ptr: 100.into(), size: 50, align: 1, }).is_err());
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Machine
impl Send for Machine
impl Sync for Machine
impl Unpin for Machine
impl UnwindSafe for Machine
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, 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>,