Skip to main content

SliceCopy

Trait SliceCopy 

Source
pub trait SliceCopy: Copy {
    // Required methods
    fn slice<R: SliceRange>(self, range: R) -> Self;
    fn get_slice<R: SliceRange>(self, range: R) -> Option<Self>;
}
Expand description

Similar to Slice, but designed to be implemented on immutable view types that implement Copy. The functionality is the same, but the lifetimes of the returned views are not tied to the input view.

Required Methods§

Source

fn slice<R: SliceRange>(self, range: R) -> Self

Creates an immutable view of the data contained in range.

Source

fn get_slice<R: SliceRange>(self, range: R) -> Option<Self>

Creates an immutable view of the data contained in range, or return None if it is out of bounds.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl SliceCopy for &[u8]

Source§

fn slice<R: SliceRange>(self, range: R) -> Self

Source§

fn get_slice<R: SliceRange>(self, range: R) -> Option<Self>

Implementors§