Trait AsSlice

Source
pub trait AsSlice {
    type Item;

    // Required methods
    const fn as_slice(&self) -> &[Self::Item];
    const fn as_mut_slice(&mut self) -> &mut [Self::Item];
}
Expand description

A trait for obtaining a slice [Self::Item]

Required Associated Types§

Required Methods§

Source

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

Yields slice from generic

Source

const fn as_mut_slice(&mut self) -> &mut [Self::Item]

Yields mutable slice from generic

Implementations on Foreign Types§

Source§

impl<T> AsSlice for [T]

Source§

type Item = T

Source§

const fn as_slice(&self) -> &[<[T] as AsSlice>::Item]

Source§

const fn as_mut_slice(&mut self) -> &mut [<[T] as AsSlice>::Item]

Source§

impl<T, A> AsSlice for Box<T, A>
where A: Allocator, T: AsSlice + ?Sized,

Source§

type Item = <T as AsSlice>::Item

Source§

const fn as_slice(&self) -> &[<Box<T, A> as AsSlice>::Item]

Source§

const fn as_mut_slice(&mut self) -> &mut [<Box<T, A> as AsSlice>::Item]

Source§

impl<T, A> AsSlice for Vec<T, A>
where A: Allocator,

Source§

type Item = T

Source§

const fn as_slice(&self) -> &[<Vec<T, A> as AsSlice>::Item]

Source§

const fn as_mut_slice(&mut self) -> &mut [<Vec<T, A> as AsSlice>::Item]

Source§

impl<T, const N: usize> AsSlice for [T; N]

Source§

type Item = T

Source§

const fn as_slice(&self) -> &[<[T; N] as AsSlice>::Item]

Source§

const fn as_mut_slice(&mut self) -> &mut [<[T; N] as AsSlice>::Item]

Implementors§