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

Returns a reference to the element stored in the specified node or None if out of Bounds

Returns a mutable reference to the element stored in the specified node or None if out of Bounds

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.

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.

Implementors