Trait Container

Source
pub trait Container:
    Len
    + Clear
    + for<'a> Push<Self::Ref<'a>>
    + Clone
    + Default
    + Send
    + 'static {
    type Ref<'a>: Copy;
    type Borrowed<'a>: Copy + Len + 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;
    fn reserve_for<'a, I>(&mut self, selves: I)
       where Self: 'a,
             I: Iterator<Item = Self::Borrowed<'a>> + Clone;

    // Provided methods
    fn with_capacity_for<'a, I>(selves: I) -> Self
       where Self: 'a,
             I: Iterator<Item = Self::Borrowed<'a>> + Clone { ... }
    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§

Source

type Ref<'a>: Copy

For each lifetime, a reference with that lifetime.

As an example, (&'a A, &'a [B]).

Source

type Borrowed<'a>: Copy + Len + Index<Ref = Self::Ref<'a>> where Self: 'a

The type of a borrowed container.

Corresponding to our example, (&'a [A], Vecs<&'a [B], &'a [u64]>).

Required Methods§

Source

fn borrow<'a>(&'a self) -> Self::Borrowed<'a>

Converts a reference to the type to a borrowed variant.

Source

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.

Source

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.

Source

fn reserve_for<'a, I>(&mut self, selves: I)
where Self: 'a, I: Iterator<Item = Self::Borrowed<'a>> + Clone,

Provided Methods§

Source

fn with_capacity_for<'a, I>(selves: I) -> Self
where Self: 'a, I: Iterator<Item = Self::Borrowed<'a>> + Clone,

Allocates an empty container that can be extended by selves without reallocation.

This goal is optimistic, and some containers may struggle to size correctly, especially if they employ compression or other variable-sizing techniques that respond to the data and the order in which is it presented. Best effort, but still useful!

Source

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.

Implementations on Foreign Types§

Source§

impl<AA: Container> Container for (AA,)

Source§

type Ref<'a> = (<AA as Container>::Ref<'a>,) where AA: 'a

Source§

type Borrowed<'a> = (<AA as Container>::Borrowed<'a>,) where AA: 'a

Source§

fn borrow<'a>(&'a self) -> Self::Borrowed<'a>

Source§

fn reborrow<'b, 'a: 'b>(thing: Self::Borrowed<'a>) -> Self::Borrowed<'b>
where AA: 'a,

Source§

fn reborrow_ref<'b, 'a: 'b>(thing: Self::Ref<'a>) -> Self::Ref<'b>
where Self: 'a,

Source§

fn extend_from_self(&mut self, other: Self::Borrowed<'_>, range: Range<usize>)

Source§

fn reserve_for<'a, I>(&mut self, selves: I)
where Self: 'a, I: Iterator<Item = Self::Borrowed<'a>> + Clone,

Source§

impl<AA: Container, BB: Container> Container for (AA, BB)

Source§

type Ref<'a> = (<AA as Container>::Ref<'a>, <BB as Container>::Ref<'a>) where AA: 'a, BB: 'a

Source§

type Borrowed<'a> = (<AA as Container>::Borrowed<'a>, <BB as Container>::Borrowed<'a>) where AA: 'a, BB: 'a

Source§

fn borrow<'a>(&'a self) -> Self::Borrowed<'a>

Source§

fn reborrow<'b, 'a: 'b>(thing: Self::Borrowed<'a>) -> Self::Borrowed<'b>
where AA: 'a, BB: 'a,

Source§

fn reborrow_ref<'b, 'a: 'b>(thing: Self::Ref<'a>) -> Self::Ref<'b>
where Self: 'a,

Source§

fn extend_from_self(&mut self, other: Self::Borrowed<'_>, range: Range<usize>)

Source§

fn reserve_for<'a, I>(&mut self, selves: I)
where Self: 'a, I: Iterator<Item = Self::Borrowed<'a>> + Clone,

Source§

impl<AA: Container, BB: Container, CC: Container> Container for (AA, BB, CC)

Source§

type Ref<'a> = (<AA as Container>::Ref<'a>, <BB as Container>::Ref<'a>, <CC as Container>::Ref<'a>) where AA: 'a, BB: 'a, CC: 'a

Source§

type Borrowed<'a> = (<AA as Container>::Borrowed<'a>, <BB as Container>::Borrowed<'a>, <CC as Container>::Borrowed<'a>) where AA: 'a, BB: 'a, CC: 'a

Source§

fn borrow<'a>(&'a self) -> Self::Borrowed<'a>

Source§

fn reborrow<'b, 'a: 'b>(thing: Self::Borrowed<'a>) -> Self::Borrowed<'b>
where AA: 'a, BB: 'a, CC: 'a,

Source§

fn reborrow_ref<'b, 'a: 'b>(thing: Self::Ref<'a>) -> Self::Ref<'b>
where Self: 'a,

Source§

fn extend_from_self(&mut self, other: Self::Borrowed<'_>, range: Range<usize>)

Source§

fn reserve_for<'a, I>(&mut self, selves: I)
where Self: 'a, I: Iterator<Item = Self::Borrowed<'a>> + Clone,

Source§

impl<AA: Container, BB: Container, CC: Container, DD: Container> Container for (AA, BB, CC, DD)

Source§

type Ref<'a> = (<AA as Container>::Ref<'a>, <BB as Container>::Ref<'a>, <CC as Container>::Ref<'a>, <DD as Container>::Ref<'a>) where AA: 'a, BB: 'a, CC: 'a, DD: 'a

Source§

type Borrowed<'a> = (<AA as Container>::Borrowed<'a>, <BB as Container>::Borrowed<'a>, <CC as Container>::Borrowed<'a>, <DD as Container>::Borrowed<'a>) where AA: 'a, BB: 'a, CC: 'a, DD: 'a

Source§

fn borrow<'a>(&'a self) -> Self::Borrowed<'a>

Source§

fn reborrow<'b, 'a: 'b>(thing: Self::Borrowed<'a>) -> Self::Borrowed<'b>
where AA: 'a, BB: 'a, CC: 'a, DD: 'a,

Source§

fn reborrow_ref<'b, 'a: 'b>(thing: Self::Ref<'a>) -> Self::Ref<'b>
where Self: 'a,

Source§

fn extend_from_self(&mut self, other: Self::Borrowed<'_>, range: Range<usize>)

Source§

fn reserve_for<'a, I>(&mut self, selves: I)
where Self: 'a, I: Iterator<Item = Self::Borrowed<'a>> + Clone,

Source§

impl<AA: Container, BB: Container, CC: Container, DD: Container, EE: Container> Container for (AA, BB, CC, DD, EE)

Source§

type Ref<'a> = (<AA as Container>::Ref<'a>, <BB as Container>::Ref<'a>, <CC as Container>::Ref<'a>, <DD as Container>::Ref<'a>, <EE as Container>::Ref<'a>) where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a

Source§

type Borrowed<'a> = (<AA as Container>::Borrowed<'a>, <BB as Container>::Borrowed<'a>, <CC as Container>::Borrowed<'a>, <DD as Container>::Borrowed<'a>, <EE as Container>::Borrowed<'a>) where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a

Source§

fn borrow<'a>(&'a self) -> Self::Borrowed<'a>

Source§

fn reborrow<'b, 'a: 'b>(thing: Self::Borrowed<'a>) -> Self::Borrowed<'b>
where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a,

Source§

fn reborrow_ref<'b, 'a: 'b>(thing: Self::Ref<'a>) -> Self::Ref<'b>
where Self: 'a,

Source§

fn extend_from_self(&mut self, other: Self::Borrowed<'_>, range: Range<usize>)

Source§

fn reserve_for<'a, I>(&mut self, selves: I)
where Self: 'a, I: Iterator<Item = Self::Borrowed<'a>> + Clone,

Source§

impl<AA: Container, BB: Container, CC: Container, DD: Container, EE: Container, FF: Container> Container for (AA, BB, CC, DD, EE, FF)

Source§

type Ref<'a> = (<AA as Container>::Ref<'a>, <BB as Container>::Ref<'a>, <CC as Container>::Ref<'a>, <DD as Container>::Ref<'a>, <EE as Container>::Ref<'a>, <FF as Container>::Ref<'a>) where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a, FF: 'a

Source§

type Borrowed<'a> = (<AA as Container>::Borrowed<'a>, <BB as Container>::Borrowed<'a>, <CC as Container>::Borrowed<'a>, <DD as Container>::Borrowed<'a>, <EE as Container>::Borrowed<'a>, <FF as Container>::Borrowed<'a>) where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a, FF: 'a

Source§

fn borrow<'a>(&'a self) -> Self::Borrowed<'a>

Source§

fn reborrow<'b, 'a: 'b>(thing: Self::Borrowed<'a>) -> Self::Borrowed<'b>
where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a, FF: 'a,

Source§

fn reborrow_ref<'b, 'a: 'b>(thing: Self::Ref<'a>) -> Self::Ref<'b>
where Self: 'a,

Source§

fn extend_from_self(&mut self, other: Self::Borrowed<'_>, range: Range<usize>)

Source§

fn reserve_for<'a, I>(&mut self, selves: I)
where Self: 'a, I: Iterator<Item = Self::Borrowed<'a>> + Clone,

Source§

impl<AA: Container, BB: Container, CC: Container, DD: Container, EE: Container, FF: Container, GG: Container> Container for (AA, BB, CC, DD, EE, FF, GG)

Source§

type Ref<'a> = (<AA as Container>::Ref<'a>, <BB as Container>::Ref<'a>, <CC as Container>::Ref<'a>, <DD as Container>::Ref<'a>, <EE as Container>::Ref<'a>, <FF as Container>::Ref<'a>, <GG as Container>::Ref<'a>) where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a, FF: 'a, GG: 'a

Source§

type Borrowed<'a> = (<AA as Container>::Borrowed<'a>, <BB as Container>::Borrowed<'a>, <CC as Container>::Borrowed<'a>, <DD as Container>::Borrowed<'a>, <EE as Container>::Borrowed<'a>, <FF as Container>::Borrowed<'a>, <GG as Container>::Borrowed<'a>) where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a, FF: 'a, GG: 'a

Source§

fn borrow<'a>(&'a self) -> Self::Borrowed<'a>

Source§

fn reborrow<'b, 'a: 'b>(thing: Self::Borrowed<'a>) -> Self::Borrowed<'b>
where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a, FF: 'a, GG: 'a,

Source§

fn reborrow_ref<'b, 'a: 'b>(thing: Self::Ref<'a>) -> Self::Ref<'b>
where Self: 'a,

Source§

fn extend_from_self(&mut self, other: Self::Borrowed<'_>, range: Range<usize>)

Source§

fn reserve_for<'a, I>(&mut self, selves: I)
where Self: 'a, I: Iterator<Item = Self::Borrowed<'a>> + Clone,

Source§

impl<AA: Container, BB: Container, CC: Container, DD: Container, EE: Container, FF: Container, GG: Container, HH: Container> Container for (AA, BB, CC, DD, EE, FF, GG, HH)

Source§

type Ref<'a> = (<AA as Container>::Ref<'a>, <BB as Container>::Ref<'a>, <CC as Container>::Ref<'a>, <DD as Container>::Ref<'a>, <EE as Container>::Ref<'a>, <FF as Container>::Ref<'a>, <GG as Container>::Ref<'a>, <HH as Container>::Ref<'a>) where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a, FF: 'a, GG: 'a, HH: 'a

Source§

type Borrowed<'a> = (<AA as Container>::Borrowed<'a>, <BB as Container>::Borrowed<'a>, <CC as Container>::Borrowed<'a>, <DD as Container>::Borrowed<'a>, <EE as Container>::Borrowed<'a>, <FF as Container>::Borrowed<'a>, <GG as Container>::Borrowed<'a>, <HH as Container>::Borrowed<'a>) where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a, FF: 'a, GG: 'a, HH: 'a

Source§

fn borrow<'a>(&'a self) -> Self::Borrowed<'a>

Source§

fn reborrow<'b, 'a: 'b>(thing: Self::Borrowed<'a>) -> Self::Borrowed<'b>
where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a, FF: 'a, GG: 'a, HH: 'a,

Source§

fn reborrow_ref<'b, 'a: 'b>(thing: Self::Ref<'a>) -> Self::Ref<'b>
where Self: 'a,

Source§

fn extend_from_self(&mut self, other: Self::Borrowed<'_>, range: Range<usize>)

Source§

fn reserve_for<'a, I>(&mut self, selves: I)
where Self: 'a, I: Iterator<Item = Self::Borrowed<'a>> + Clone,

Source§

impl<AA: Container, BB: Container, CC: Container, DD: Container, EE: Container, FF: Container, GG: Container, HH: Container, II: Container> Container for (AA, BB, CC, DD, EE, FF, GG, HH, II)

Source§

type Ref<'a> = (<AA as Container>::Ref<'a>, <BB as Container>::Ref<'a>, <CC as Container>::Ref<'a>, <DD as Container>::Ref<'a>, <EE as Container>::Ref<'a>, <FF as Container>::Ref<'a>, <GG as Container>::Ref<'a>, <HH as Container>::Ref<'a>, <II as Container>::Ref<'a>) where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a, FF: 'a, GG: 'a, HH: 'a, II: 'a

Source§

type Borrowed<'a> = (<AA as Container>::Borrowed<'a>, <BB as Container>::Borrowed<'a>, <CC as Container>::Borrowed<'a>, <DD as Container>::Borrowed<'a>, <EE as Container>::Borrowed<'a>, <FF as Container>::Borrowed<'a>, <GG as Container>::Borrowed<'a>, <HH as Container>::Borrowed<'a>, <II as Container>::Borrowed<'a>) where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a, FF: 'a, GG: 'a, HH: 'a, II: 'a

Source§

fn borrow<'a>(&'a self) -> Self::Borrowed<'a>

Source§

fn reborrow<'b, 'a: 'b>(thing: Self::Borrowed<'a>) -> Self::Borrowed<'b>
where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a, FF: 'a, GG: 'a, HH: 'a, II: 'a,

Source§

fn reborrow_ref<'b, 'a: 'b>(thing: Self::Ref<'a>) -> Self::Ref<'b>
where Self: 'a,

Source§

fn extend_from_self(&mut self, other: Self::Borrowed<'_>, range: Range<usize>)

Source§

fn reserve_for<'a, I>(&mut self, selves: I)
where Self: 'a, I: Iterator<Item = Self::Borrowed<'a>> + Clone,

Source§

impl<AA: Container, BB: Container, CC: Container, DD: Container, EE: Container, FF: Container, GG: Container, HH: Container, II: Container, JJ: Container> Container for (AA, BB, CC, DD, EE, FF, GG, HH, II, JJ)

Source§

type Ref<'a> = (<AA as Container>::Ref<'a>, <BB as Container>::Ref<'a>, <CC as Container>::Ref<'a>, <DD as Container>::Ref<'a>, <EE as Container>::Ref<'a>, <FF as Container>::Ref<'a>, <GG as Container>::Ref<'a>, <HH as Container>::Ref<'a>, <II as Container>::Ref<'a>, <JJ as Container>::Ref<'a>) where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a, FF: 'a, GG: 'a, HH: 'a, II: 'a, JJ: 'a

Source§

type Borrowed<'a> = (<AA as Container>::Borrowed<'a>, <BB as Container>::Borrowed<'a>, <CC as Container>::Borrowed<'a>, <DD as Container>::Borrowed<'a>, <EE as Container>::Borrowed<'a>, <FF as Container>::Borrowed<'a>, <GG as Container>::Borrowed<'a>, <HH as Container>::Borrowed<'a>, <II as Container>::Borrowed<'a>, <JJ as Container>::Borrowed<'a>) where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a, FF: 'a, GG: 'a, HH: 'a, II: 'a, JJ: 'a

Source§

fn borrow<'a>(&'a self) -> Self::Borrowed<'a>

Source§

fn reborrow<'b, 'a: 'b>(thing: Self::Borrowed<'a>) -> Self::Borrowed<'b>
where AA: 'a, BB: 'a, CC: 'a, DD: 'a, EE: 'a, FF: 'a, GG: 'a, HH: 'a, II: 'a, JJ: 'a,

Source§

fn reborrow_ref<'b, 'a: 'b>(thing: Self::Ref<'a>) -> Self::Ref<'b>
where Self: 'a,

Source§

fn extend_from_self(&mut self, other: Self::Borrowed<'_>, range: Range<usize>)

Source§

fn reserve_for<'a, I>(&mut self, selves: I)
where Self: 'a, I: Iterator<Item = Self::Borrowed<'a>> + Clone,

Source§

impl<T: Clone + Send + 'static> Container for Vec<T>

Source§

type Ref<'a> = &'a T

Source§

type Borrowed<'a> = &'a [T]

Source§

fn borrow<'a>(&'a self) -> Self::Borrowed<'a>

Source§

fn reborrow<'b, 'a: 'b>(item: Self::Borrowed<'a>) -> Self::Borrowed<'b>
where Self: 'a,

Source§

fn reborrow_ref<'b, 'a: 'b>(item: Self::Ref<'a>) -> Self::Ref<'b>
where Self: 'a,

Source§

fn extend_from_self(&mut self, other: Self::Borrowed<'_>, range: Range<usize>)

Source§

fn reserve_for<'a, I>(&mut self, selves: I)
where Self: 'a, I: Iterator<Item = Self::Borrowed<'a>> + Clone,

Implementors§

Source§

impl Container for Strides

Source§

type Ref<'a> = u64

Source§

type Borrowed<'a> = Strides<&'a [u64], &'a u64>

Source§

impl Container for Empties

Source§

type Ref<'a> = ()

Source§

type Borrowed<'a> = Empties<&'a u64>

Source§

impl<BC: PushIndexAs<u64>> Container for Strings<BC, Vec<u8>>

Source§

type Ref<'a> = &'a str

Source§

type Borrowed<'a> = Strings<<BC as Container>::Borrowed<'a>, &'a [u8]> where BC: 'a

Source§

impl<BC: PushIndexAs<u64>, TC: Container> Container for Vecs<TC, BC>

Source§

type Ref<'a> = Slice<<TC as Container>::Borrowed<'a>> where TC: 'a

Source§

type Borrowed<'a> = Vecs<<TC as Container>::Borrowed<'a>, <BC as Container>::Borrowed<'a>> where BC: 'a, TC: 'a

Source§

impl<CV: PushIndexAs<i64>> Container for Isizes<CV>

Source§

type Ref<'a> = isize

Source§

type Borrowed<'a> = Isizes<<CV as Container>::Borrowed<'a>> where CV: 'a

Source§

impl<CV: PushIndexAs<u32>> Container for Chars<CV>

Source§

type Ref<'a> = char

Source§

type Borrowed<'a> = Chars<<CV as Container>::Borrowed<'a>> where CV: 'a

Source§

impl<CV: PushIndexAs<u64>> Container for Usizes<CV>

Source§

type Ref<'a> = usize

Source§

type Borrowed<'a> = Usizes<<CV as Container>::Borrowed<'a>> where CV: 'a

Source§

impl<CV: PushIndexAs<[u8; 16]>> Container for I128s<CV>

Source§

type Ref<'a> = i128

Source§

type Borrowed<'a> = I128s<<CV as Container>::Borrowed<'a>> where CV: 'a

Source§

impl<CV: PushIndexAs<[u8; 16]>> Container for U128s<CV>

Source§

type Ref<'a> = u128

Source§

type Borrowed<'a> = U128s<<CV as Container>::Borrowed<'a>> where CV: 'a

Source§

impl<SC: PushIndexAs<u64>, NC: PushIndexAs<u32>> Container for Durations<SC, NC>

Source§

type Ref<'a> = Duration

Source§

type Borrowed<'a> = Durations<<SC as Container>::Borrowed<'a>, <NC as Container>::Borrowed<'a>> where SC: 'a, NC: 'a

Source§

impl<SC: Container, TC: Container> Container for Results<SC, TC>

Source§

type Ref<'a> = Result<<SC as Container>::Ref<'a>, <TC as Container>::Ref<'a>> where SC: 'a, TC: 'a

Source§

type Borrowed<'a> = Results<<SC as Container>::Borrowed<'a>, <TC as Container>::Borrowed<'a>, &'a [u64], &'a [u64], &'a u64> where SC: 'a, TC: 'a

Source§

impl<TC: Container> Container for Options<TC>

Source§

type Ref<'a> = Option<<TC as Container>::Ref<'a>> where TC: 'a

Source§

type Borrowed<'a> = Options<<TC as Container>::Borrowed<'a>, &'a [u64], &'a [u64], &'a u64> where TC: 'a

Source§

impl<VC: PushIndexAs<u64>> Container for Bools<VC>

Source§

type Ref<'a> = bool

Source§

type Borrowed<'a> = Bools<<VC as Container>::Borrowed<'a>, &'a u64> where VC: 'a

Source§

impl<const K: u64> Container for Fixeds<K>

Source§

type Ref<'a> = u64

Source§

type Borrowed<'a> = Fixeds<K, &'a u64>