pub struct Allocation { /* private fields */ }Expand description
Metadata for the allocation attempt that was selected for injected failure.
Implementations§
Source§impl Allocation
impl Allocation
Sourcepub fn index(&self) -> usize
pub fn index(&self) -> usize
Zero-based allocation attempt index.
Examples found in repository?
examples/scenarios.rs (line 159)
154fn print_allocation_metadata(report: &alloc_chaos::Report) {
155 for attempt in report.attempts() {
156 if let Some(allocation) = attempt.injected_allocation() {
157 println!(
158 "metadata: target #{} -> {} size={} align={} new_size={:?}",
159 allocation.index(),
160 allocation.operation(),
161 allocation.size(),
162 allocation.align(),
163 allocation.new_size(),
164 );
165 }
166 }
167}Sourcepub fn operation(&self) -> AllocOp
pub fn operation(&self) -> AllocOp
Allocator operation used by this attempt.
Examples found in repository?
examples/scenarios.rs (line 160)
154fn print_allocation_metadata(report: &alloc_chaos::Report) {
155 for attempt in report.attempts() {
156 if let Some(allocation) = attempt.injected_allocation() {
157 println!(
158 "metadata: target #{} -> {} size={} align={} new_size={:?}",
159 allocation.index(),
160 allocation.operation(),
161 allocation.size(),
162 allocation.align(),
163 allocation.new_size(),
164 );
165 }
166 }
167}Sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
Requested layout size in bytes.
Examples found in repository?
examples/scenarios.rs (line 161)
154fn print_allocation_metadata(report: &alloc_chaos::Report) {
155 for attempt in report.attempts() {
156 if let Some(allocation) = attempt.injected_allocation() {
157 println!(
158 "metadata: target #{} -> {} size={} align={} new_size={:?}",
159 allocation.index(),
160 allocation.operation(),
161 allocation.size(),
162 allocation.align(),
163 allocation.new_size(),
164 );
165 }
166 }
167}Sourcepub fn align(&self) -> usize
pub fn align(&self) -> usize
Requested layout alignment in bytes.
Examples found in repository?
examples/scenarios.rs (line 162)
154fn print_allocation_metadata(report: &alloc_chaos::Report) {
155 for attempt in report.attempts() {
156 if let Some(allocation) = attempt.injected_allocation() {
157 println!(
158 "metadata: target #{} -> {} size={} align={} new_size={:?}",
159 allocation.index(),
160 allocation.operation(),
161 allocation.size(),
162 allocation.align(),
163 allocation.new_size(),
164 );
165 }
166 }
167}Sourcepub fn new_size(&self) -> Option<usize>
pub fn new_size(&self) -> Option<usize>
Requested new size for AllocOp::Realloc attempts.
Examples found in repository?
examples/scenarios.rs (line 163)
154fn print_allocation_metadata(report: &alloc_chaos::Report) {
155 for attempt in report.attempts() {
156 if let Some(allocation) = attempt.injected_allocation() {
157 println!(
158 "metadata: target #{} -> {} size={} align={} new_size={:?}",
159 allocation.index(),
160 allocation.operation(),
161 allocation.size(),
162 allocation.align(),
163 allocation.new_size(),
164 );
165 }
166 }
167}Trait Implementations§
Source§impl Clone for Allocation
impl Clone for Allocation
Source§fn clone(&self) -> Allocation
fn clone(&self) -> Allocation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Allocation
impl Debug for Allocation
Source§impl Display for Allocation
impl Display for Allocation
Source§impl PartialEq for Allocation
impl PartialEq for Allocation
Source§fn eq(&self, other: &Allocation) -> bool
fn eq(&self, other: &Allocation) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for Allocation
impl Eq for Allocation
impl StructuralPartialEq for Allocation
Auto Trait Implementations§
impl Freeze for Allocation
impl RefUnwindSafe for Allocation
impl Send for Allocation
impl Sync for Allocation
impl Unpin for Allocation
impl UnsafeUnpin for Allocation
impl UnwindSafe for Allocation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more