pub trait Allocator {
    type Committer: Committer;

Show 21 methods fn free<T>(&self) -> usize; fn section<T>(
        &mut self,
        f: impl FnOnce(&mut Self) -> Result<T>
    ) -> Result<(T, usize)>; fn allocate_input_layout<'a>(
        &mut self,
        layout: Layout
    ) -> Result<InRef<'a, [u8]>>; fn allocate_output_layout<'a>(
        &mut self,
        layout: Layout
    ) -> Result<OutRef<'a, [u8]>>; fn allocate_inout_layout<'a>(
        &mut self,
        layout: Layout
    ) -> Result<InOutRef<'a, [u8]>>; fn reserve_input_layout<'a, T, F>(
        &mut self,
        layout: Layout,
        f: F
    ) -> Result<(T, InRef<'a, [u8]>)>
    where
        F: FnOnce(&mut Self) -> Result<T>
; fn reserve_output_layout<'a, T, F>(
        &mut self,
        layout: Layout,
        f: F
    ) -> Result<(T, OutRef<'a, [u8]>)>
    where
        F: FnOnce(&mut Self) -> Result<T>
; fn reserve_inout_layout<'a, T, F>(
        &mut self,
        layout: Layout,
        f: F
    ) -> Result<(T, InOutRef<'a, [u8]>)>
    where
        F: FnOnce(&mut Self) -> Result<T>
; fn commit(self) -> Self::Committer; fn allocate_input<'a, T>(&mut self) -> Result<InRef<'a, T>> { ... } fn allocate_output<'a, T>(&mut self) -> Result<OutRef<'a, T>> { ... } fn allocate_inout<'a, T>(&mut self) -> Result<InOutRef<'a, T>> { ... } fn reserve_input<'a, T, U>(
        &mut self,
        f: impl FnOnce(&mut Self) -> Result<U>
    ) -> Result<(U, InRef<'a, T>)> { ... } fn reserve_output<'a, T, U>(
        &mut self,
        f: impl FnOnce(&mut Self) -> Result<U>
    ) -> Result<(U, OutRef<'a, T>)> { ... } fn reserve_inout<'a, T, U>(
        &mut self,
        f: impl FnOnce(&mut Self) -> Result<U>
    ) -> Result<(U, InOutRef<'a, T>)> { ... } fn allocate_input_slice<'a, T>(
        &mut self,
        len: usize
    ) -> Result<InRef<'a, [T]>> { ... } fn allocate_input_slice_max<'a, T>(
        &mut self,
        len: usize
    ) -> Result<InRef<'a, [T]>> { ... } fn allocate_output_slice<'a, T>(
        &mut self,
        len: usize
    ) -> Result<OutRef<'a, [T]>> { ... } fn allocate_output_slice_max<'a, T>(
        &mut self,
        len: usize
    ) -> Result<OutRef<'a, [T]>> { ... } fn allocate_inout_slice<'a, T>(
        &mut self,
        len: usize
    ) -> Result<InOutRef<'a, [T]>> { ... } fn allocate_inout_slice_max<'a, T>(
        &mut self,
        len: usize
    ) -> Result<InOutRef<'a, [T]>> { ... }
}
Expand description

Allocator in stage phase.

Required Associated Types

Required Methods

Returns amount of elements of type T that can still be allocated.

Creates a new section and returns the size of it in bytes.

Attempts to allocate an arbitrary input Layout and returns corresponding InRef on success.

Attempts to allocate an arbitrary output Layout and returns corresponding OutRef on success.

Attempts to allocate an arbitrary inout Layout and returns corresponding InOutRef on success.

Attempts to reserve an arbitrary input Layout and returns corresponding InRef on success.

Attempts to reserve an arbitrary output Layout and returns corresponding OutRef on success.

Attempts to reserve an arbitrary inout Layout and returns corresponding InOutRef on success.

Records the end of stage phase and moves allocator into commit phase.

Provided Methods

Attempts to allocate an input of type T and returns corresponding InRef on success.

Attempts to allocate an output of type T and returns corresponding OutRef on success.

Attempts to allocate an inout of type T and returns corresponding InOutRef on success.

Attempts to reserve an input of type T and returns corresponding InRef on success.

Attempts to reserve an output of type T and returns corresponding OutRef on success.

Attempts to reserve an inout of type T and returns corresponding InOutRef on success.

Attempts to allocate a slice input of len elements of type T and returns corresponding InRef on success.

Attempts to allocate a slice input of at most len elements of type T depending on capacity and returns corresponding InRef on success.

Attempts to allocate a slice output of len elements of type T and returns corresponding OutRef on success.

Attempts to allocate a slice output of at most len elements of type T depending on capacity and returns corresponding OutRef on success.

Attempts to allocate a slice inout of len elements of type T and returns corresponding InOutRef on success.

Attempts to allocate a slice inout of at most len elements of type T depending on capacity and returns corresponding InOutRef on success.

Implementors