Skip to main content

FromOffset

Trait FromOffset 

Source
pub trait FromOffset<T>
where T: Sized,
{ // Required method fn from_offset<U: ToOffset>(&self, relative_index: U) -> Option<&T>; }
Expand description

Provide from_offset convenience method that allows negative offsets from the end of an array/vector and never extends beyond the array/vector bounds It returns Option<&T> in keeping with the default get() method and because the array or vector may still be empty

Required Methods§

Source

fn from_offset<U: ToOffset>(&self, relative_index: U) -> Option<&T>

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<T> FromOffset<T> for [T]

Source§

fn from_offset<U: ToOffset>(&self, relative_index: U) -> Option<&T>

Implementors§