Skip to main content

SysExOutputPool

Struct SysExOutputPool 

Source
pub struct SysExOutputPool { /* private fields */ }
Expand description

Pre-allocated pool for SysEx output messages.

Avoids heap allocation during audio processing by pre-allocating a fixed number of buffer slots at initialization time.

Implementations§

Source§

impl SysExOutputPool

Source

pub const DEFAULT_SLOTS: usize = 16

Default number of SysEx slots per process block.

Source

pub const DEFAULT_BUFFER_SIZE: usize = 512

Default maximum size per SysEx message.

Source

pub fn new() -> Self

Create a new pool with default capacity.

Source

pub fn with_capacity(slots: usize, buffer_size: usize) -> Self

Create a new pool with the specified capacity.

Pre-allocates all buffers to avoid heap allocation during process().

Source

pub fn clear(&mut self)

Clear the pool for reuse. O(1) operation.

Note: This does NOT clear the fallback buffer, which is drained separately at the start of the next process block.

Source

pub fn allocate(&mut self, data: &[u8]) -> Option<(*const u8, usize)>

Allocate a slot and copy SysEx data into it.

Returns Some((pointer, length)) on success, None if pool exhausted. The pointer is stable until clear() is called.

Sets the overflow flag when the pool is exhausted. With sysex-heap-fallback feature: overflow messages are stored in a heap-backed fallback buffer instead of being dropped.

Source

pub fn allocate_slice(&mut self, data: &[u8]) -> Option<&[u8]>

Allocate and return a slice reference instead of raw pointer.

Safer API for contexts that don’t need raw pointers.

Source

pub fn has_overflowed(&self) -> bool

Check if the pool overflowed during this block.

Source

pub fn capacity(&self) -> usize

Get the pool’s slot capacity.

Source

pub fn used(&self) -> usize

Get number of slots currently used.

Trait Implementations§

Source§

impl Default for SysExOutputPool

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.