pub trait BatchContainer: 'static {
type PushItem;
type ReadItem<'a>: Copy + MyTrait<'a, Owned = Self::PushItem> + for<'b> PartialOrd<Self::ReadItem<'b>>;
// Required methods
fn copy(&mut self, item: Self::ReadItem<'_>);
fn with_capacity(size: usize) -> Self;
fn merge_capacity(cont1: &Self, cont2: &Self) -> Self;
fn index(&self, index: usize) -> Self::ReadItem<'_>;
fn len(&self) -> usize;
// Provided methods
fn push(&mut self, item: Self::PushItem) { ... }
fn copy_push(&mut self, item: &Self::PushItem) { ... }
fn copy_range(&mut self, other: &Self, start: usize, end: usize) { ... }
fn last(&self) -> Option<Self::ReadItem<'_>> { ... }
fn is_empty(&self) -> bool { ... }
fn advance<F: for<'a> Fn(Self::ReadItem<'a>) -> bool>(
&self,
start: usize,
end: usize,
function: F
) -> usize { ... }
}
Expand description
A general-purpose container resembling Vec<T>
.
Required Associated Types§
Required Methods§
sourcefn with_capacity(size: usize) -> Self
fn with_capacity(size: usize) -> Self
Creates a new container with sufficient capacity.
sourcefn merge_capacity(cont1: &Self, cont2: &Self) -> Self
fn merge_capacity(cont1: &Self, cont2: &Self) -> Self
Creates a new container with sufficient capacity.
Provided Methods§
sourcefn copy_range(&mut self, other: &Self, start: usize, end: usize)
fn copy_range(&mut self, other: &Self, start: usize, end: usize)
Extends from a range of items in anotherSelf
.
sourcefn last(&self) -> Option<Self::ReadItem<'_>>
fn last(&self) -> Option<Self::ReadItem<'_>>
Returns the last item if the container is non-empty.
sourcefn advance<F: for<'a> Fn(Self::ReadItem<'a>) -> bool>(
&self,
start: usize,
end: usize,
function: F
) -> usize
fn advance<F: for<'a> Fn(Self::ReadItem<'a>) -> bool>( &self, start: usize, end: usize, function: F ) -> usize
Reports the number of elements satisfing the predicate.
This methods relies strongly on the assumption that the predicate
stays false once it becomes false, a joint property of the predicate
and the layout of Self. This allows
advance` to use exponential search to
count the number of elements in time logarithmic in the result.
Object Safety§
This trait is not object safe.