Trait SplitAt

Source
pub trait SplitAt<Idx>: IndexRange<Idx> {
    // Required method
    fn split_at(
        &self,
        index: Idx,
    ) -> (&<Self as Index<RangeFull>>::Output, &<Self as Index<RangeFull>>::Output);
}
Expand description

A trait for splitting a collection into two pieces at a given index.

Splitting a collection must take a constant amount of time and space.

Required Methods§

Source

fn split_at( &self, index: Idx, ) -> (&<Self as Index<RangeFull>>::Output, &<Self as Index<RangeFull>>::Output)

Splits the collection into two pieces at the given index.

§Panics

Panics if index is invalid according to the collection.

Implementations on Foreign Types§

Source§

impl SplitAt<usize> for str

Source§

fn split_at(&self, index: usize) -> (&Self, &Self)

Source§

impl<T> SplitAt<usize> for [T]

Source§

fn split_at(&self, index: usize) -> (&Self, &Self)

Implementors§