Trait FromOffset

Source
pub trait FromOffset<T> {
    // Required method
    fn from_offset<U>(&self, relative_index: U) -> Option<&T>
       where U: ToOffset;
}
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>(&self, relative_index: U) -> Option<&T>
where U: ToOffset,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> FromOffset<T> for [T]

Source§

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

Implementors§