rustc_type_ir::inherent

Trait SliceLike

source
pub trait SliceLike: Sized + Copy {
    type Item: Copy;
    type IntoIter: Iterator<Item = Self::Item>;

    // Required methods
    fn iter(self) -> Self::IntoIter;
    fn as_slice(&self) -> &[Self::Item];

    // Provided methods
    fn get(self, idx: usize) -> Option<Self::Item> { ... }
    fn len(self) -> usize { ... }
    fn is_empty(self) -> bool { ... }
    fn contains(self, t: &Self::Item) -> bool
       where Self::Item: PartialEq { ... }
    fn to_vec(self) -> Vec<Self::Item> { ... }
    fn last(self) -> Option<Self::Item> { ... }
    fn split_last(&self) -> Option<(&Self::Item, &[Self::Item])> { ... }
}

Required Associated Types§

source

type Item: Copy

source

type IntoIter: Iterator<Item = Self::Item>

Required Methods§

source

fn iter(self) -> Self::IntoIter

source

fn as_slice(&self) -> &[Self::Item]

Provided Methods§

source

fn get(self, idx: usize) -> Option<Self::Item>

source

fn len(self) -> usize

source

fn is_empty(self) -> bool

source

fn contains(self, t: &Self::Item) -> bool
where Self::Item: PartialEq,

source

fn to_vec(self) -> Vec<Self::Item>

source

fn last(self) -> Option<Self::Item>

source

fn split_last(&self) -> Option<(&Self::Item, &[Self::Item])>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a, S: SliceLike> SliceLike for &'a S

source§

type Item = <S as SliceLike>::Item

source§

type IntoIter = <S as SliceLike>::IntoIter

source§

fn iter(self) -> Self::IntoIter

source§

fn as_slice(&self) -> &[Self::Item]

source§

impl<'a, T: Copy> SliceLike for &'a [T]

source§

type Item = T

source§

type IntoIter = Copied<Iter<'a, T>>

source§

fn iter(self) -> Self::IntoIter

source§

fn as_slice(&self) -> &[Self::Item]

source§

impl<'a, T: Copy, const N: usize> SliceLike for &'a [T; N]

source§

type Item = T

source§

type IntoIter = Copied<Iter<'a, T>>

source§

fn iter(self) -> Self::IntoIter

source§

fn as_slice(&self) -> &[Self::Item]

Implementors§