Skip to main content

CommandScratch

Struct CommandScratch 

Source
pub struct CommandScratch<C: Copy> { /* private fields */ }
Expand description

Reusable storage for trivially owned command descriptors.

The caller clears the logical length between recording epochs. Capacity never grows, so push is allocation-free after construction.

Implementations§

Source§

impl<C: Copy> CommandScratch<C>

Source

pub fn new(capacity: usize) -> Self

Allocates storage for at most capacity commands.

Source

pub fn clear(&mut self)

Starts a new recording epoch while retaining allocated storage.

Source

pub fn push(&mut self, command: C) -> Result<(), ScratchFull>

Appends one command without growing storage.

§Errors

Returns ScratchFull when fixed capacity is exhausted.

Source

pub fn as_slice(&self) -> &[C]

Commands recorded in the current epoch.

Source

pub fn as_mut_slice(&mut self) -> &mut [C]

Mutable command storage for in-place lowering or sorting.

Source

pub const fn capacity(&self) -> usize

Fixed command capacity.

Source

pub const fn metrics(&self) -> CommandScratchMetrics

Current cumulative counters.

Trait Implementations§

Source§

impl<C: Copy + Debug> Debug for CommandScratch<C>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<C> Freeze for CommandScratch<C>
where Vec<C>: Freeze,

§

impl<C> RefUnwindSafe for CommandScratch<C>
where Vec<C>: RefUnwindSafe,

§

impl<C> Send for CommandScratch<C>
where Vec<C>: Send,

§

impl<C> Sync for CommandScratch<C>
where Vec<C>: Sync,

§

impl<C> Unpin for CommandScratch<C>
where Vec<C>: Unpin,

§

impl<C> UnsafeUnpin for CommandScratch<C>
where Vec<C>: UnsafeUnpin,

§

impl<C> UnwindSafe for CommandScratch<C>
where Vec<C>: UnwindSafe,

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.