[][src]Trait alloc_compose::CallbackRef

pub unsafe trait CallbackRef {
    pub fn before_allocate(&self, layout: Layout) { ... }
pub fn after_allocate(
        &self,
        layout: Layout,
        result: Result<NonNull<[u8]>, AllocError>
    ) { ... }
pub fn before_allocate_zeroed(&self, layout: Layout) { ... }
pub fn after_allocate_zeroed(
        &self,
        layout: Layout,
        result: Result<NonNull<[u8]>, AllocError>
    ) { ... }
pub fn before_allocate_all(&self) { ... }
pub fn after_allocate_all(&self, result: Result<NonNull<[u8]>, AllocError>) { ... }
pub fn before_allocate_all_zeroed(&self) { ... }
pub fn after_allocate_all_zeroed(
        &self,
        result: Result<NonNull<[u8]>, AllocError>
    ) { ... }
pub fn before_deallocate(&self, ptr: NonNull<u8>, layout: Layout) { ... }
pub fn after_deallocate(&self, ptr: NonNull<u8>, layout: Layout) { ... }
pub fn before_deallocate_all(&self) { ... }
pub fn after_deallocate_all(&self) { ... }
pub fn before_grow(
        &self,
        ptr: NonNull<u8>,
        old_layout: Layout,
        new_layout: Layout
    ) { ... }
pub fn after_grow(
        &self,
        ptr: NonNull<u8>,
        old_layout: Layout,
        new_layout: Layout,
        result: Result<NonNull<[u8]>, AllocError>
    ) { ... }
pub fn before_grow_zeroed(
        &self,
        ptr: NonNull<u8>,
        old_layout: Layout,
        new_layout: Layout
    ) { ... }
pub fn after_grow_zeroed(
        &self,
        ptr: NonNull<u8>,
        old_layout: Layout,
        new_layout: Layout,
        result: Result<NonNull<[u8]>, AllocError>
    ) { ... }
pub fn before_grow_in_place(
        &self,
        ptr: NonNull<u8>,
        old_layout: Layout,
        new_layout: Layout
    ) { ... }
pub fn after_grow_in_place(
        &self,
        ptr: NonNull<u8>,
        old_layout: Layout,
        new_layout: Layout,
        result: Result<usize, AllocError>
    ) { ... }
pub fn before_grow_in_place_zeroed(
        &self,
        ptr: NonNull<u8>,
        old_layout: Layout,
        new_layout: Layout
    ) { ... }
pub fn after_grow_in_place_zeroed(
        &self,
        ptr: NonNull<u8>,
        old_layout: Layout,
        new_layout: Layout,
        result: Result<usize, AllocError>
    ) { ... }
pub fn before_shrink(
        &self,
        ptr: NonNull<u8>,
        old_layout: Layout,
        new_layout: Layout
    ) { ... }
pub fn after_shrink(
        &self,
        ptr: NonNull<u8>,
        old_layout: Layout,
        new_layout: Layout,
        result: Result<NonNull<[u8]>, AllocError>
    ) { ... }
pub fn before_shrink_in_place(
        &self,
        ptr: NonNull<u8>,
        old_layout: Layout,
        new_layout: Layout
    ) { ... }
pub fn after_shrink_in_place(
        &self,
        ptr: NonNull<u8>,
        old_layout: Layout,
        new_layout: Layout,
        result: Result<usize, AllocError>
    ) { ... }
pub fn before_owns(&self) { ... }
pub fn after_owns(&self, success: bool) { ... }
pub fn by_ref(&self) -> &Self { ... } }

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

Provided methods

pub fn before_allocate(&self, layout: Layout)[src]

Called before alloc was invoked.

pub fn after_allocate(
    &self,
    layout: Layout,
    result: Result<NonNull<[u8]>, AllocError>
)
[src]

Called after alloc was invoked.

pub fn before_allocate_zeroed(&self, layout: Layout)[src]

Called before alloc_zeroed was invoked.

pub fn after_allocate_zeroed(
    &self,
    layout: Layout,
    result: Result<NonNull<[u8]>, AllocError>
)
[src]

Called after alloc_zeroed was invoked.

pub fn before_allocate_all(&self)[src]

Called before allocate_all was invoked.

pub fn after_allocate_all(&self, result: Result<NonNull<[u8]>, AllocError>)[src]

Called after allocate_all was invoked.

pub fn before_allocate_all_zeroed(&self)[src]

Called before allocate_all_zeroed was invoked.

pub fn after_allocate_all_zeroed(
    &self,
    result: Result<NonNull<[u8]>, AllocError>
)
[src]

Called after allocate_all_zeroed was invoked.

pub fn before_deallocate(&self, ptr: NonNull<u8>, layout: Layout)[src]

Called before dealloc was invoked.

pub fn after_deallocate(&self, ptr: NonNull<u8>, layout: Layout)[src]

Called after dealloc was invoked.

pub fn before_deallocate_all(&self)[src]

Called before deallocate_all was invoked.

pub fn after_deallocate_all(&self)[src]

Called after deallocate_all was invoked.

pub fn before_grow(
    &self,
    ptr: NonNull<u8>,
    old_layout: Layout,
    new_layout: Layout
)
[src]

Called before grow was invoked.

pub fn after_grow(
    &self,
    ptr: NonNull<u8>,
    old_layout: Layout,
    new_layout: Layout,
    result: Result<NonNull<[u8]>, AllocError>
)
[src]

Called after grow was invoked.

pub fn before_grow_zeroed(
    &self,
    ptr: NonNull<u8>,
    old_layout: Layout,
    new_layout: Layout
)
[src]

Called before grow_zeroed was invoked.

pub fn after_grow_zeroed(
    &self,
    ptr: NonNull<u8>,
    old_layout: Layout,
    new_layout: Layout,
    result: Result<NonNull<[u8]>, AllocError>
)
[src]

Called after grow_zeroed was invoked.

pub fn before_grow_in_place(
    &self,
    ptr: NonNull<u8>,
    old_layout: Layout,
    new_layout: Layout
)
[src]

Called before grow_in_place was invoked.

pub fn after_grow_in_place(
    &self,
    ptr: NonNull<u8>,
    old_layout: Layout,
    new_layout: Layout,
    result: Result<usize, AllocError>
)
[src]

Called after grow_in_place was invoked.

pub fn before_grow_in_place_zeroed(
    &self,
    ptr: NonNull<u8>,
    old_layout: Layout,
    new_layout: Layout
)
[src]

Called before grow_in_place_zeroed was invoked.

pub fn after_grow_in_place_zeroed(
    &self,
    ptr: NonNull<u8>,
    old_layout: Layout,
    new_layout: Layout,
    result: Result<usize, AllocError>
)
[src]

Called after grow_in_place_zeroed was invoked.

pub fn before_shrink(
    &self,
    ptr: NonNull<u8>,
    old_layout: Layout,
    new_layout: Layout
)
[src]

Called before shrink was invoked.

pub fn after_shrink(
    &self,
    ptr: NonNull<u8>,
    old_layout: Layout,
    new_layout: Layout,
    result: Result<NonNull<[u8]>, AllocError>
)
[src]

Called after shrink was invoked.

pub fn before_shrink_in_place(
    &self,
    ptr: NonNull<u8>,
    old_layout: Layout,
    new_layout: Layout
)
[src]

Called before shrink_in_place was invoked.

pub fn after_shrink_in_place(
    &self,
    ptr: NonNull<u8>,
    old_layout: Layout,
    new_layout: Layout,
    result: Result<usize, AllocError>
)
[src]

Called after shrink_in_place was invoked.

pub fn before_owns(&self)[src]

Called before owns was invoked.

pub fn after_owns(&self, success: bool)[src]

Called after owns was invoked.

pub fn by_ref(&self) -> &Self[src]

Creates a "by reference" adaptor for this instance of CallbackRef.

The returned adaptor also implements CallbackRef and will simply borrow this.

Loading content...

Implementations on Foreign Types

impl<C: ?Sized> CallbackRef for Box<C> where
    C: CallbackRef
[src]

This is supported on crate feature alloc only.

impl<C: ?Sized> CallbackRef for Rc<C> where
    C: CallbackRef
[src]

This is supported on crate feature alloc only.

impl<C: ?Sized> CallbackRef for Arc<C> where
    C: CallbackRef
[src]

This is supported on crate feature alloc only.
Loading content...

Implementors

impl CallbackRef for AtomicCounter[src]

impl CallbackRef for Counter[src]

impl CallbackRef for FilteredAtomicCounter[src]

impl CallbackRef for FilteredCounter[src]

impl<C: ?Sized, '_> CallbackRef for &'_ C where
    C: CallbackRef
[src]

Loading content...