Struct mz_timely_util::containers::stack::ChunkedStack
source · pub struct ChunkedStack<T: Columnation> {
local: Vec<Array<T>>,
inner: T::InnerRegion,
length: usize,
}
Expand description
An append-only vector that store records as columns.
This container maintains elements that might conventionally own
memory allocations, but instead the pointers to those allocations
reference larger regions of memory shared with multiple instances
of the type. Elements can be retrieved as references, and care is
taken when this type is dropped to ensure that the correct memory
is returned (rather than the incorrect memory, from running the
elements Drop
implementations).
Fields§
§local: Vec<Array<T>>
§inner: T::InnerRegion
§length: usize
Implementations§
source§impl<T: Columnation> ChunkedStack<T>
impl<T: Columnation> ChunkedStack<T>
sourceconst CHUNK: usize = 65_536usize
const CHUNK: usize = 65_536usize
The capacity of each individual chunk, in number of elements. Should be a power of two.
sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Construct a ChunkedStack
, reserving space for capacity
elements
Note that the associated region is not initialized to a specific capacity because we can’t generally know how much space would be required.
sourcepub fn reserve_items<'a, I>(&'a mut self, items: I)
pub fn reserve_items<'a, I>(&'a mut self, items: I)
Ensures Self
can absorb items
without further allocations.
The argument items
may be cloned and iterated multiple times.
Please be careful if it contains side effects.
sourcepub fn reserve_regions<'a, I>(&mut self, regions: I)
pub fn reserve_regions<'a, I>(&mut self, regions: I)
Ensures Self
can absorb regions
without further allocations.
The argument regions
may be cloned and iterated multiple times.
Please be careful if it contains side effects.
sourcepub fn copy(&mut self, item: &T)
pub fn copy(&mut self, item: &T)
Copies an element in to the region.
The element can be read by indexing
sourcefn push(&mut self, item: T)
fn push(&mut self, item: T)
Internal helper to push a copied item onto the local storage. The item
must be allocated
in the region, because it will not be dropped.
sourcepub fn heap_size(&self, callback: impl FnMut(usize, usize))
pub fn heap_size(&self, callback: impl FnMut(usize, usize))
Estimate the memory capacity in bytes.
Trait Implementations§
source§impl<T: Ord + Columnation + ToOwned<Owned = T> + 'static> BatchContainer for ChunkedStack<T>
impl<T: Ord + Columnation + ToOwned<Owned = T> + 'static> BatchContainer for ChunkedStack<T>
§type ReadItem<'a> = &'a <ChunkedStack<T> as BatchContainer>::Owned
type ReadItem<'a> = &'a <ChunkedStack<T> as BatchContainer>::Owned
source§fn with_capacity(size: usize) -> Self
fn with_capacity(size: usize) -> Self
source§fn merge_capacity(cont1: &Self, cont2: &Self) -> Self
fn merge_capacity(cont1: &Self, cont2: &Self) -> Self
source§fn reborrow<'b, 'a: 'b>(item: Self::ReadItem<'a>) -> Self::ReadItem<'b>
fn reborrow<'b, 'a: 'b>(item: Self::ReadItem<'a>) -> Self::ReadItem<'b>
source§fn index(&self, index: usize) -> Self::ReadItem<'_>
fn index(&self, index: usize) -> Self::ReadItem<'_>
source§impl<T: Columnation> Clone for ChunkedStack<T>
impl<T: Columnation> Clone for ChunkedStack<T>
source§impl<T: Columnation + 'static> Container for ChunkedStack<T>
impl<T: Columnation + 'static> Container for ChunkedStack<T>
§type ItemRef<'a> = &'a T
where
Self: 'a
type ItemRef<'a> = &'a T where Self: 'a
source§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
len() == 0
.source§fn clear(&mut self)
fn clear(&mut self)
self
while retaining allocated memory.
After calling clear
, is_empty
must return true
and len
0.source§fn iter(&self) -> Self::Iter<'_>
fn iter(&self) -> Self::Iter<'_>
source§impl<T: Columnation> Default for ChunkedStack<T>
impl<T: Columnation> Default for ChunkedStack<T>
source§impl<'a, T: Columnation + Deserialize<'a>> Deserialize<'a> for ChunkedStack<T>
impl<'a, T: Columnation + Deserialize<'a>> Deserialize<'a> for ChunkedStack<T>
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'a>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'a>,
source§impl<T: Columnation> Drop for ChunkedStack<T>
impl<T: Columnation> Drop for ChunkedStack<T>
source§impl<T: Columnation> Index<usize> for ChunkedStack<T>
impl<T: Columnation> Index<usize> for ChunkedStack<T>
source§impl<T: Columnation> PushInto<&T> for ChunkedStack<T>
impl<T: Columnation> PushInto<&T> for ChunkedStack<T>
source§impl<T: Columnation + Serialize> Serialize for ChunkedStack<T>
impl<T: Columnation + Serialize> Serialize for ChunkedStack<T>
Auto Trait Implementations§
impl<T> Freeze for ChunkedStack<T>
impl<T> RefUnwindSafe for ChunkedStack<T>
impl<T> Send for ChunkedStack<T>
impl<T> Sync for ChunkedStack<T>
impl<T> Unpin for ChunkedStack<T>
impl<T> UnwindSafe for ChunkedStack<T>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign
, for types that do not implement AddAssign
.