to_offset

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>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

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

source§

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

Implementors§