pub trait Container:
Len
+ Clear
+ for<'a> Push<Self::Ref<'a>>
+ Clone
+ Default
+ Send
+ 'static {
type Ref<'a>: Copy;
type Borrowed<'a>: Copy + Len + AsBytes<'a> + FromBytes<'a> + Index<Ref = Self::Ref<'a>>
where Self: 'a;
// Required methods
fn borrow<'a>(&'a self) -> Self::Borrowed<'a>;
fn reborrow<'b, 'a: 'b>(item: Self::Borrowed<'a>) -> Self::Borrowed<'b>
where Self: 'a;
fn reborrow_ref<'b, 'a: 'b>(item: Self::Ref<'a>) -> Self::Ref<'b>
where Self: 'a;
// Provided method
fn extend_from_self(
&mut self,
other: Self::Borrowed<'_>,
range: Range<usize>,
) { ... }
}Expand description
A container that can hold C, and provide its preferred references.
As an example, (Vec<A>, Vecs<Vec<B>>).
Required Associated Types§
Required Methods§
Sourcefn borrow<'a>(&'a self) -> Self::Borrowed<'a>
fn borrow<'a>(&'a self) -> Self::Borrowed<'a>
Converts a reference to the type to a borrowed variant.
Sourcefn reborrow<'b, 'a: 'b>(item: Self::Borrowed<'a>) -> Self::Borrowed<'b>where
Self: 'a,
fn reborrow<'b, 'a: 'b>(item: Self::Borrowed<'a>) -> Self::Borrowed<'b>where
Self: 'a,
Reborrows the borrowed type to a shorter lifetime. See Columnar::reborrow for details.
Sourcefn reborrow_ref<'b, 'a: 'b>(item: Self::Ref<'a>) -> Self::Ref<'b>where
Self: 'a,
fn reborrow_ref<'b, 'a: 'b>(item: Self::Ref<'a>) -> Self::Ref<'b>where
Self: 'a,
Reborrows the borrowed type to a shorter lifetime. See Columnar::reborrow for details.
Provided Methods§
Sourcefn extend_from_self(&mut self, other: Self::Borrowed<'_>, range: Range<usize>)
fn extend_from_self(&mut self, other: Self::Borrowed<'_>, range: Range<usize>)
Extends self by a range in other.
This method has a default implementation, but can and should be specialized when ranges can be copied. As an example, lists of lists are often backed by contiguous elements, all of which can be memcopied, with only the offsets into them (the bounds) to push either before or after (rather than during).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.