Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

PrimitiveArena

Struct PrimitiveArena 

Source
pub struct PrimitiveArena<'f, P> { /* private fields */ }
Expand description

Hands out packets from caller storage as &'f mut P, one slot each.

The storage is borrowed for 'f, so it cannot be reused (a new arena over it, say) while any packet it handed out is still linked into a frame.

Implementations§

Source§

impl<'f, P> PrimitiveArena<'f, P>

Source

pub fn new(storage: &'f mut [P]) -> Self

Hand out the slots of storage, front to back.

Source

pub fn push(&mut self, packet: P) -> Option<&'f mut P>

Store packet in the next free slot and return it for the rest of 'f; None once the storage is used up.

Source

pub fn len(&self) -> usize

Slots handed out so far.

Source

pub fn is_empty(&self) -> bool

True if nothing was handed out yet.

Source

pub fn remaining(&self) -> usize

Slots still free.

Trait Implementations§

Source§

impl<'f, P: Debug> Debug for PrimitiveArena<'f, P>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'f, P> Freeze for PrimitiveArena<'f, P>

§

impl<'f, P> RefUnwindSafe for PrimitiveArena<'f, P>
where P: RefUnwindSafe,

§

impl<'f, P> !Send for PrimitiveArena<'f, P>

§

impl<'f, P> !Sync for PrimitiveArena<'f, P>

§

impl<'f, P> Unpin for PrimitiveArena<'f, P>

§

impl<'f, P> UnsafeUnpin for PrimitiveArena<'f, P>

§

impl<'f, P> !UnwindSafe for PrimitiveArena<'f, P>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.