Skip to main content

AsSlice

Trait AsSlice 

Source
pub trait AsSlice {
    type Element;

    // Required method
    fn as_slice(&self) -> &[Self::Element];
}
Expand description

Something that can be seen as an immutable slice

Required Associated Types§

Source

type Element

The element type of the slice view

Required Methods§

Source

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

Returns the immutable slice view of Self

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a, S> AsSlice for &'a S
where S: ?Sized + AsSlice,

Source§

type Element = <S as AsSlice>::Element

Source§

fn as_slice(&self) -> &[S::Element]

Source§

impl<'a, S> AsSlice for &'a mut S
where S: ?Sized + AsSlice,

Source§

type Element = <S as AsSlice>::Element

Source§

fn as_slice(&self) -> &[S::Element]

Source§

impl<T> AsSlice for [T]

Source§

type Element = T

Source§

fn as_slice(&self) -> &[T]

Source§

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

Source§

type Element = T

Source§

fn as_slice(&self) -> &[T]

Implementors§