Trait tuple::TupleElements
source · pub unsafe trait TupleElements: Sized {
type Element;
const N: usize;
// Required methods
fn get(&self, n: usize) -> Option<&Self::Element>;
fn get_mut(&mut self, n: usize) -> Option<&mut Self::Element>;
fn from_iter<I>(iter: I) -> Option<Self>
where I: Iterator<Item = Self::Element>;
// Provided methods
fn elements(&self) -> Elements<&Self> ⓘ { ... }
fn elements_mut(&mut self) -> Elements<&mut Self> ⓘ { ... }
fn into_elements(self) -> IntoElements<Self> ⓘ { ... }
}
Expand description
This trait is marked as unsafe, due to the requirement of the get_mut method,
which is required work as an injective map of index -> element
A tuple must not have a Drop
implementation.
Required Associated Types§
Required Associated Constants§
Required Methods§
sourcefn get_mut(&mut self, n: usize) -> Option<&mut Self::Element>
fn get_mut(&mut self, n: usize) -> Option<&mut Self::Element>
attempt to access the n-th element mutablbly. This function shall not return the same data for two different indices.
fn from_iter<I>(iter: I) -> Option<Self>
Provided Methods§
sourcefn elements(&self) -> Elements<&Self> ⓘ
fn elements(&self) -> Elements<&Self> ⓘ
returns an Iterator over references to the elements of the tuple
sourcefn elements_mut(&mut self) -> Elements<&mut Self> ⓘ
fn elements_mut(&mut self) -> Elements<&mut Self> ⓘ
returns an Iterator over mutable references to elements of the tuple
fn into_elements(self) -> IntoElements<Self> ⓘ
Object Safety§
This trait is not object safe.