ringal

Struct RingAl

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

Ring Allocator, see crate level documentation on features and usage

Implementations§

Source§

impl RingAl

Source

pub fn new(size: usize) -> Self

Initialize ring allocator with given capacity and default alignment. Allocated capacity might be different from what was requested, but will contain at least size bytes.

NOTE: not entire capacity will be available for allocation due to guard headers being part of allocations and taking up space as well

Source

pub fn new_with_align(size: usize, align: usize) -> Self

Initialize ring allocator with given capacity and alignment. Allocated capacity might be different from what was requested, but will contain at least size bytes.

NOTE: not entire capacity will be available for allocation due to guard headers being part of allocations and taking up space as well

Source

pub fn fixed(&mut self, size: usize) -> Option<FixedBufMut>

Try to allocate a fixed (non-extandable) buffer with at least size bytes of capacity, the operation will fail, returning None, if backing store doesn’t have enough capacity available.

Source

pub fn extendable(&mut self, size: usize) -> Option<ExtBuf<'_>>

Try to allocate an extandable buffer with at least size bytes of initial capacity, the operation will fail, returning None, if backing store doesn’t have enough capacity available.

NOTE: the allocated buffer contains an exclusive reference to allocator (used to dynamically grow the buffer), which effectively prevents any further allocations while this buffer is around

Auto Trait Implementations§

§

impl Freeze for RingAl

§

impl RefUnwindSafe for RingAl

§

impl !Send for RingAl

§

impl !Sync for RingAl

§

impl Unpin for RingAl

§

impl UnwindSafe for RingAl

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.