Struct mz_ore::region::LgAllocRegion
source · pub struct LgAllocRegion<T> {
local: Region<T>,
stash: Vec<Region<T>>,
limit: usize,
}
Expand description
A region allocator which holds items at stable memory locations.
Items once inserted will not be moved, and their locations in memory can be relied on by others, until the region is cleared.
This type accepts owned data, rather than references, and does not
itself intend to implement Region
. Rather, it is a useful building
block for other less-safe code that wants allocated data to remain at
fixed memory locations.
Fields§
§local: Region<T>
The active allocation into which we are writing.
stash: Vec<Region<T>>
All previously active allocations.
limit: usize
The maximum allocation size
Implementations§
source§impl<T> LgAllocRegion<T>
impl<T> LgAllocRegion<T>
sourcepub fn with_limit(limit: usize) -> Self
pub fn with_limit(limit: usize) -> Self
Construct a LgAllocRegion with a allocation size limit.
sourcepub fn copy_iter<I>(&mut self, items: I) -> &mut [T]where
I: Iterator<Item = T> + ExactSizeIterator,
pub fn copy_iter<I>(&mut self, items: I) -> &mut [T]where
I: Iterator<Item = T> + ExactSizeIterator,
Copies an iterator of items into the region.
sourcepub fn copy_slice(&mut self, items: &[T]) -> &mut [T]where
T: Clone,
pub fn copy_slice(&mut self, items: &[T]) -> &mut [T]where
T: Clone,
Copies a slice of cloneable items into the region.
sourcepub fn reserve(&mut self, count: usize)
pub fn reserve(&mut self, count: usize)
Ensures that there is space in self.local
to copy at least count
items.
sourcepub fn with_capacity(count: usize) -> Self
pub fn with_capacity(count: usize) -> Self
Allocates a new Self
that can accept count
items without reallocation.
Trait Implementations§
source§impl<T> Debug for LgAllocRegion<T>
impl<T> Debug for LgAllocRegion<T>
Auto Trait Implementations§
impl<T> Freeze for LgAllocRegion<T>
impl<T> RefUnwindSafe for LgAllocRegion<T>where
T: RefUnwindSafe,
impl<T> Send for LgAllocRegion<T>where
T: Send,
impl<T> Sync for LgAllocRegion<T>where
T: Sync,
impl<T> Unpin for LgAllocRegion<T>where
T: Unpin,
impl<T> UnwindSafe for LgAllocRegion<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request