Struct graph_theory::PureNode
source · pub struct PureNode<M> { /* private fields */ }
Implementations§
source§impl<M> PureNode<M>
impl<M> PureNode<M>
pub fn new(index: usize, metadata: M) -> PureNode<M>
pub fn as_ref(&self) -> PureNode<&M>
sourcepub fn re_mut(node: PureNode<&mut M>) -> &mut PureNode<M>
pub fn re_mut(node: PureNode<&mut M>) -> &mut PureNode<M>
Cast the inner mutable reference to outer mutable reference.
Safety
The memory layout of PureNode<&mut M>
and &mut PureNode<M>
is the same, so we can safely cast between them.
index
is leaked and promoted, make sure you don’t modify its value.
Examples
let ref_inner = PureNode::new(0, &mut 0);
let ref_outer = PureNode::re_mut(ref_inner);
Trait Implementations§
source§impl<M> PartialEq<PureNode<M>> for PureNode<M>where
M: PartialEq<M>,
impl<M> PartialEq<PureNode<M>> for PureNode<M>where M: PartialEq<M>,
impl<M> Copy for PureNode<M>where M: Copy,
impl<M> Eq for PureNode<M>where M: Eq,
impl<M> StructuralEq for PureNode<M>
impl<M> StructuralPartialEq for PureNode<M>
Auto Trait Implementations§
impl<M> RefUnwindSafe for PureNode<M>where M: RefUnwindSafe,
impl<M> Send for PureNode<M>where M: Send,
impl<M> Sync for PureNode<M>where M: Sync,
impl<M> Unpin for PureNode<M>where M: Unpin,
impl<M> UnwindSafe for PureNode<M>where M: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more