[−][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.
Required methods
fn alloc(
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
Called when alloc
was invoked.
fn dealloc(&self, ptr: NonNull<u8>, layout: Layout)
Called when dealloc
was invoked.
fn 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 when grow
was invoked.
fn 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 when shrink
was invoked.
fn owns(&self, success: bool)
Called when owns
was invoked.
Provided methods
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 alloc(
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
fn dealloc(&self, ptr: NonNull<u8>, layout: Layout)
[src]
fn 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 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 owns(&self, success: bool)
[src]
impl<C: CallbackRef> CallbackRef for Rc<C>
[src]
This is only available with the "alloc"-feature enabled.
fn alloc(
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
fn dealloc(&self, ptr: NonNull<u8>, layout: Layout)
[src]
fn 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 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 owns(&self, success: bool)
[src]
impl<C: CallbackRef> CallbackRef for Arc<C>
[src]
This is only available with the "alloc"-feature enabled.
fn alloc(
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
fn dealloc(&self, ptr: NonNull<u8>, layout: Layout)
[src]
fn 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 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 owns(&self, success: bool)
[src]
Implementors
impl CallbackRef for AtomicCounter
[src]
fn alloc(
&self,
_layout: Layout,
_init: AllocInit,
_result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
_layout: Layout,
_init: AllocInit,
_result: Result<MemoryBlock, AllocErr>
)
fn dealloc(&self, _ptr: NonNull<u8>, _layout: Layout)
[src]
fn 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 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 owns(&self, _success: bool)
[src]
impl CallbackRef for Counter
[src]
fn alloc(
&self,
_layout: Layout,
_init: AllocInit,
_result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
_layout: Layout,
_init: AllocInit,
_result: Result<MemoryBlock, AllocErr>
)
fn dealloc(&self, _ptr: NonNull<u8>, _layout: Layout)
[src]
fn 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 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 owns(&self, _success: bool)
[src]
impl CallbackRef for FilteredAtomicCounter
[src]
fn alloc(
&self,
_layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
_layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
fn dealloc(&self, _ptr: NonNull<u8>, _layout: Layout)
[src]
fn 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 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 owns(&self, success: bool)
[src]
impl CallbackRef for FilteredCounter
[src]
fn alloc(
&self,
_layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
_layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
fn dealloc(&self, _ptr: NonNull<u8>, _layout: Layout)
[src]
fn 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 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 owns(&self, success: bool)
[src]
impl<'_, C: CallbackRef> CallbackRef for &'_ C
[src]
fn alloc(
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
[src]
&self,
layout: Layout,
init: AllocInit,
result: Result<MemoryBlock, AllocErr>
)
fn dealloc(&self, ptr: NonNull<u8>, layout: Layout)
[src]
fn 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 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>
)