pub struct MockAllocator { /* private fields */ }Expand description
The core allocator trait, implemented by all allocators.
Implementations§
Source§impl MockAllocator
impl MockAllocator
Sourcepub fn checkpoint(&mut self)
pub fn checkpoint(&mut self)
Validate that all current expectations for all methods have been satisfied, and discard them.
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new mock object with no expectations.
This method will not be generated if the real struct
already has a new method. However, it will be
generated if the struct implements a trait with a new
method. The trait’s new method can still be called
like <MockX as TraitY>::new
Source§impl MockAllocator
impl MockAllocator
Sourcepub fn expect_allocate(&mut self) -> &mut Expectation
pub fn expect_allocate(&mut self) -> &mut Expectation
Create an Expectation for mocking the allocate method
Trait Implementations§
Source§impl Allocator for MockAllocator
The core allocator trait, implemented by all allocators.
impl Allocator for MockAllocator
The core allocator trait, implemented by all allocators.
Source§type Alloc = MockAllocWrapper
type Alloc = MockAllocWrapper
The type of Alloc produced by this allocator.
Source§fn allocate<'life0, 'async_trait>(
&'life0 mut self,
spec: AllocSpec,
) -> Pin<Box<dyn Future<Output = Result<MockAllocWrapper, AllocatorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn allocate<'life0, 'async_trait>(
&'life0 mut self,
spec: AllocSpec,
) -> Pin<Box<dyn Future<Output = Result<MockAllocWrapper, AllocatorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create a new allocation. The allocation itself is generally returned immediately (after validating parameters, etc.); the caller is expected to respond to allocation events as the underlying procs are incrementally allocated.
Source§impl Debug for MockAllocator
impl Debug for MockAllocator
Auto Trait Implementations§
impl Freeze for MockAllocator
impl RefUnwindSafe for MockAllocator
impl Send for MockAllocator
impl Sync for MockAllocator
impl Unpin for MockAllocator
impl UnwindSafe for MockAllocator
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more