[−][src]Crate checkers
Checkers is a simple allocation checker for Rust that runs purely inside of Rust.
Examples
You use checkers by installing it's allocator, then making use of either the
#[checkers::test]
or checkers::with!
macros.
#[global_allocator] static CHECKED: checkers::Allocator = checkers::Allocator; #[checkers::test] fn test_allocations() { let _ = Box::into_raw(Box::new(42)); } #[test] fn test_manually() { checkers::with!(|| { let _ = Box::into_raw(Box::new(42)); }); }
Macros
verify | Verify the state of the allocator. |
with | Run the given function inside of the allocation checker. |
Structs
Allocator | Allocator that needs to be installed. |
Events | A fixed-size collection of allocations. |
Machine | Fake machine implementation to validate an allocation history. |
Pointer | A type-erased pointer. The inner representation is specifically not a raw pointer to avoid aliasing the pointers handled by the allocator. |
ThreadLocalState | Structure containing all thread-local state required to use the single-threaded allocation checker. |
Enums
Event | Metadata for a single allocation or deallocation. |
Constants
STATE | Thread-local state required by the allocator. |
Attribute Macros
test | Marks a function to be run as a test in a checkers test suite. |