Trait net_ensembles::traits::Contained [−][src]
pub trait Contained<T> {
fn get_contained(&self, index: usize) -> Option<&T>;
fn get_contained_mut(&mut self, index: usize) -> Option<&mut T>;
unsafe fn get_contained_unchecked(&self, index: usize) -> &T;
unsafe fn get_contained_unchecked_mut(&mut self, index: usize) -> &mut T;
}
Expand description
Trait for types that have an underlying graph with nodes which each contain some T
.
Used to access said T
Required methods
fn get_contained(&self, index: usize) -> Option<&T>
fn get_contained(&self, index: usize) -> Option<&T>
Returns a reference to the element stored in the specified node or None
if out of Bounds
fn get_contained_mut(&mut self, index: usize) -> Option<&mut T>
fn get_contained_mut(&mut self, index: usize) -> Option<&mut T>
Returns a mutable reference to the element stored in the specified node or None
if out of Bounds
unsafe fn get_contained_unchecked(&self, index: usize) -> &T
unsafe fn get_contained_unchecked(&self, index: usize) -> &T
For a save alternative see get_contained
Safety
Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.
unsafe fn get_contained_unchecked_mut(&mut self, index: usize) -> &mut T
unsafe fn get_contained_unchecked_mut(&mut self, index: usize) -> &mut T
Returns a mutable reference to the element stored in the specified node
For a save alternative see get_contained_mut
Safety
Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.