pub trait TryAllocateBuffer<'a> {
type Buffer;
// Required method
fn try_allocate_buffer(
&'a self,
size: usize,
) -> Result<Self::Buffer, EventListener>;
// Provided method
fn allocate_buffer_sync(&'a self, size: usize) -> Self::Buffer { ... }
}Expand description
A trait for buffer allocators that support asynchronous buffer allocation via event listeners.
Required Associated Types§
Required Methods§
Sourcefn try_allocate_buffer(
&'a self,
size: usize,
) -> Result<Self::Buffer, EventListener>
fn try_allocate_buffer( &'a self, size: usize, ) -> Result<Self::Buffer, EventListener>
Attempts to allocate a buffer of size bytes. Returns an EventListener to wait on if
memory is temporarily unavailable.
Provided Methods§
Sourcefn allocate_buffer_sync(&'a self, size: usize) -> Self::Buffer
fn allocate_buffer_sync(&'a self, size: usize) -> Self::Buffer
Allocates a buffer synchronously, blocking the current thread until memory is available.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".