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