[−][src]Trait alloc_compose::CallbackRef
Backend for the Proxy
allocator.
As Callback
is used in Proxy
and AllocRef
requires, that a cloned allocator must
behave like the same allocator, Clone
must not be implemented on types, which don't
have a shared state. It's possible to use a reference by calling by_ref
or to
wrapping them into Rc
or Arc
in order to make them cloneable instead. Note, that
Box
, Rc
, and Arc
requires the "alloc"
-feature to be enabled.
Safety
Clone
must not be implemented on types, which don't have a shared state.
Provided methods
fn before_alloc(&self, layout: Layout, init: AllocInit)
Called before alloc
was invoked.
fn after_alloc(
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
Called after alloc
was invoked.
fn before_dealloc(&self, ptr: NonNull<u8>, layout: Layout)
Called before dealloc
was invoked.
fn after_dealloc(&self, ptr: NonNull<u8>, layout: Layout)
Called after dealloc
was invoked.
fn before_grow(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit
)
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit
)
Called before grow
was invoked.
fn after_grow(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
Called after grow
was invoked.
fn before_shrink(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement
)
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement
)
Called before shrink
was invoked.
fn after_shrink(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
result: Result<MemoryBlock, AllocErr>
)
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
result: Result<MemoryBlock, AllocErr>
)
Called after shrink
was invoked.
fn before_owns(&self)
Called before owns
was invoked.
fn after_owns(&self, success: bool)
Called after owns
was invoked.
fn by_ref(&self) -> &Self
Creates a "by reference" adaptor for this instance of CallbackRef
.
The returned adaptor also implements CallbackRef
and will simply borrow this.
Implementations on Foreign Types
impl<C: CallbackRef> CallbackRef for Box<C>
[src]
This is only available with the "alloc"-feature enabled.
fn before_alloc(&self, layout: Layout, init: AllocInit)
[src]
fn after_alloc(
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
fn before_dealloc(&self, ptr: NonNull<u8>, layout: Layout)
[src]
fn after_dealloc(&self, ptr: NonNull<u8>, layout: Layout)
[src]
fn before_shrink(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement
)
[src]
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement
)
fn after_shrink(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
result: Result<MemoryBlock, AllocErr>
)
fn before_grow(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit
)
[src]
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit
)
fn after_grow(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
fn before_owns(&self)
[src]
fn after_owns(&self, success: bool)
[src]
impl<C: CallbackRef> CallbackRef for Rc<C>
[src]
This is only available with the "alloc"-feature enabled.
fn before_alloc(&self, layout: Layout, init: AllocInit)
[src]
fn after_alloc(
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
fn before_dealloc(&self, ptr: NonNull<u8>, layout: Layout)
[src]
fn after_dealloc(&self, ptr: NonNull<u8>, layout: Layout)
[src]
fn before_shrink(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement
)
[src]
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement
)
fn after_shrink(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
result: Result<MemoryBlock, AllocErr>
)
fn before_grow(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit
)
[src]
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit
)
fn after_grow(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
fn before_owns(&self)
[src]
fn after_owns(&self, success: bool)
[src]
impl<C: CallbackRef> CallbackRef for Arc<C>
[src]
This is only available with the "alloc"-feature enabled.
fn before_alloc(&self, layout: Layout, init: AllocInit)
[src]
fn after_alloc(
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
fn before_dealloc(&self, ptr: NonNull<u8>, layout: Layout)
[src]
fn after_dealloc(&self, ptr: NonNull<u8>, layout: Layout)
[src]
fn before_shrink(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement
)
[src]
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement
)
fn after_shrink(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
result: Result<MemoryBlock, AllocErr>
)
fn before_grow(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit
)
[src]
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit
)
fn after_grow(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
fn before_owns(&self)
[src]
fn after_owns(&self, success: bool)
[src]
Implementors
impl CallbackRef for AtomicCounter
[src]
fn after_alloc(
&self,
_layout: Layout,
_init: AllocInit,
_result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
_layout: Layout,
_init: AllocInit,
_result: Result<MemoryBlock, AllocErr>
)
fn before_dealloc(&self, _ptr: NonNull<u8>, _layout: Layout)
[src]
fn after_grow(
&self,
_ptr: NonNull<u8>,
_layout: Layout,
_new_size: usize,
_placement: ReallocPlacement,
_init: AllocInit,
_result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
_ptr: NonNull<u8>,
_layout: Layout,
_new_size: usize,
_placement: ReallocPlacement,
_init: AllocInit,
_result: Result<MemoryBlock, AllocErr>
)
fn after_shrink(
&self,
_ptr: NonNull<u8>,
_layout: Layout,
_new_size: usize,
_placement: ReallocPlacement,
_result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
_ptr: NonNull<u8>,
_layout: Layout,
_new_size: usize,
_placement: ReallocPlacement,
_result: Result<MemoryBlock, AllocErr>
)
fn after_owns(&self, _success: bool)
[src]
impl CallbackRef for Counter
[src]
fn after_alloc(
&self,
_layout: Layout,
_init: AllocInit,
_result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
_layout: Layout,
_init: AllocInit,
_result: Result<MemoryBlock, AllocErr>
)
fn before_dealloc(&self, _ptr: NonNull<u8>, _layout: Layout)
[src]
fn after_grow(
&self,
_ptr: NonNull<u8>,
_layout: Layout,
_new_size: usize,
_placement: ReallocPlacement,
_init: AllocInit,
_result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
_ptr: NonNull<u8>,
_layout: Layout,
_new_size: usize,
_placement: ReallocPlacement,
_init: AllocInit,
_result: Result<MemoryBlock, AllocErr>
)
fn after_shrink(
&self,
_ptr: NonNull<u8>,
_layout: Layout,
_new_size: usize,
_placement: ReallocPlacement,
_result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
_ptr: NonNull<u8>,
_layout: Layout,
_new_size: usize,
_placement: ReallocPlacement,
_result: Result<MemoryBlock, AllocErr>
)
fn after_owns(&self, _success: bool)
[src]
impl CallbackRef for FilteredAtomicCounter
[src]
fn after_alloc(
&self,
_layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
_layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
fn before_dealloc(&self, _ptr: NonNull<u8>, _layout: Layout)
[src]
fn after_grow(
&self,
_ptr: NonNull<u8>,
_layout: Layout,
_new_size: usize,
placement: ReallocPlacement,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
_ptr: NonNull<u8>,
_layout: Layout,
_new_size: usize,
placement: ReallocPlacement,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
fn after_shrink(
&self,
_ptr: NonNull<u8>,
_layout: Layout,
_new_size: usize,
placement: ReallocPlacement,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
_ptr: NonNull<u8>,
_layout: Layout,
_new_size: usize,
placement: ReallocPlacement,
result: Result<MemoryBlock, AllocErr>
)
fn after_owns(&self, success: bool)
[src]
impl CallbackRef for FilteredCounter
[src]
fn after_alloc(
&self,
_layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
_layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
fn before_dealloc(&self, _ptr: NonNull<u8>, _layout: Layout)
[src]
fn after_grow(
&self,
_ptr: NonNull<u8>,
_layout: Layout,
_new_size: usize,
placement: ReallocPlacement,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
_ptr: NonNull<u8>,
_layout: Layout,
_new_size: usize,
placement: ReallocPlacement,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
fn after_shrink(
&self,
_ptr: NonNull<u8>,
_layout: Layout,
_new_size: usize,
placement: ReallocPlacement,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
_ptr: NonNull<u8>,
_layout: Layout,
_new_size: usize,
placement: ReallocPlacement,
result: Result<MemoryBlock, AllocErr>
)
fn after_owns(&self, success: bool)
[src]
impl<C: CallbackRef, '_> CallbackRef for &'_ C
[src]
fn before_alloc(&self, layout: Layout, init: AllocInit)
[src]
fn after_alloc(
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
fn before_dealloc(&self, ptr: NonNull<u8>, layout: Layout)
[src]
fn after_dealloc(&self, ptr: NonNull<u8>, layout: Layout)
[src]
fn before_shrink(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement
)
[src]
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement
)
fn after_shrink(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
result: Result<MemoryBlock, AllocErr>
)
fn before_grow(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit
)
[src]
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit
)
fn after_grow(
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
ptr: NonNull<u8>,
layout: Layout,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)