[][src]Struct wasm_tracing_allocator::WasmTracingAllocator

pub struct WasmTracingAllocator<A>(pub A)
where
    A: GlobalAlloc
;

A global allocator that traces the Wasm module's allocations and deallocations.

It wraps some global allocator A that actually implements the allocation and deallocation, and inserts its tracing after each invocation.

Example

Just give it the global allocator A to wrap, and add the #[global_allocator] attribute. The module level documentation has an example of wrapping the default system allocator. Here is an example of wrapping wee_alloc:

This example is not tested
// src/lib.rs

use wasm_tracing_allocator::WasmTracingAllocator;
use wee_alloc::WeeAlloc;

#[global_allocator]
static GLOBAL_ALLOCATOR: WasmTracingAllocator<WeeAlloc> =
    WasmTracingAllocator(WeeAlloc::INIT);

Trait Implementations

impl<A: Debug> Debug for WasmTracingAllocator<A> where
    A: GlobalAlloc
[src]

impl<A> GlobalAlloc for WasmTracingAllocator<A> where
    A: GlobalAlloc
[src]

Auto Trait Implementations

impl<A> Send for WasmTracingAllocator<A> where
    A: Send

impl<A> Sync for WasmTracingAllocator<A> where
    A: Sync

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]