pub struct FailAfter { /* private fields */ }Expand description
Policy that permits the first successes allocations and fails
every allocation thereafter.
Models a fixed-capacity allocator that runs out: the OOM cliff lands
at a precise, reproducible request number regardless of request
sizes. Stateful — the success counter is an AtomicUsize, so the
policy is Send + Sync and a Faulty parameterised by it can wrap
a multi-threaded allocator.
Implementations§
Trait Implementations§
Source§impl AllocFaultPolicy for FailAfter
impl AllocFaultPolicy for FailAfter
Source§fn should_fail(&self, _layout: NonZeroLayout) -> bool
fn should_fail(&self, _layout: NonZeroLayout) -> bool
Return
true to force the pending allocation of layout to
fail with AllocError; return false to
let it proceed to the inner allocator. Read moreAuto Trait Implementations§
impl !Freeze for FailAfter
impl RefUnwindSafe for FailAfter
impl Send for FailAfter
impl Sync for FailAfter
impl Unpin for FailAfter
impl UnsafeUnpin for FailAfter
impl UnwindSafe for FailAfter
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