Skip to main content

Slice

Trait Slice 

Source
pub trait Slice:
    IndexMut<Range<usize>, Output = Self>
    + IndexMut<RangeTo<usize>, Output = Self>
    + IndexMut<RangeFrom<usize>, Output = Self> {
    // Required methods
    fn len(&self) -> usize;
    fn transform_index(&self, index: usize) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}

Required Methods§

Source

fn len(&self) -> usize

Source

fn transform_index(&self, index: usize) -> usize

Provided Methods§

Source

fn is_empty(&self) -> bool

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Slice for str

Source§

fn len(&self) -> usize

Source§

fn transform_index(&self, index: usize) -> usize

Source§

impl<T> Slice for [T]

Source§

fn len(&self) -> usize

Source§

fn transform_index(&self, index: usize) -> usize

Implementors§