Skip to main content

FramePool

Struct FramePool 

Source
pub struct FramePool<'m, const N: usize> { /* private fields */ }
Expand description

N equal slots carved from one buffer.

Implementations§

Source§

impl<'m, const N: usize> FramePool<'m, N>

Source

pub fn new(buf: &'m mut [u8]) -> Result<Self>

Split buf into N slots. N must be 1..=255 and each slot at least one byte; the trailing remainder of buf is unused.

Source

pub fn slot_len(&self) -> usize

Bytes per slot.

Source

pub fn free_slots(&self) -> usize

Slots not currently acquired.

Source

pub fn acquire(&mut self) -> Option<SlotId>

Take a free slot, or None when all are in use (a dropped frame, by policy of the caller — never a block).

Source

pub fn release(&mut self, id: SlotId) -> Result<()>

Return a slot to the pool.

Source

pub fn slot_mut(&mut self, id: SlotId) -> Result<&mut [u8]>

The whole slot, for filling.

Source

pub fn commit(&mut self, id: SlotId, used: usize) -> Result<()>

Record how many bytes of the slot hold the frame (a JPEG is shorter than its slot; a raw frame fills exactly its geometry).

Source

pub fn slot(&self, id: SlotId) -> Result<&[u8]>

The committed bytes of a slot.

Source

pub fn frame( &self, id: SlotId, geometry: Geometry, timestamp: Micros, sequence: u32, ) -> Result<Frame<'_>>

A validated frame view over the committed bytes of a slot.

Trait Implementations§

Source§

impl<'m, const N: usize> Debug for FramePool<'m, N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'m, const N: usize> !UnwindSafe for FramePool<'m, N>

§

impl<'m, const N: usize> Freeze for FramePool<'m, N>
where [bool; N]: Freeze, [usize; N]: Freeze,

§

impl<'m, const N: usize> RefUnwindSafe for FramePool<'m, N>

§

impl<'m, const N: usize> Send for FramePool<'m, N>
where [bool; N]: Send, [usize; N]: Send,

§

impl<'m, const N: usize> Sync for FramePool<'m, N>
where [bool; N]: Sync, [usize; N]: Sync,

§

impl<'m, const N: usize> Unpin for FramePool<'m, N>
where [bool; N]: Unpin, [usize; N]: Unpin,

§

impl<'m, const N: usize> UnsafeUnpin for FramePool<'m, N>

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.