Struct traitgraph::index::OptionalNodeIndex
source · [−]pub struct OptionalNodeIndex<IndexType: Sized>(_);Expand description
A node index that can be None.
This is a hack to get a small sized Option<NodeIndex> by storing the None variant as IndexType::max_value().
If Rust ever adds support for integer types with invalid values other than 0, this type becomes obsolete.
Trait Implementations
sourceimpl<IndexType: Clone + Sized> Clone for OptionalNodeIndex<IndexType>
impl<IndexType: Clone + Sized> Clone for OptionalNodeIndex<IndexType>
sourcefn clone(&self) -> OptionalNodeIndex<IndexType>
fn clone(&self) -> OptionalNodeIndex<IndexType>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl<IndexType: PrimInt + Hash> Debug for OptionalNodeIndex<IndexType>
impl<IndexType: PrimInt + Hash> Debug for OptionalNodeIndex<IndexType>
sourceimpl<IndexType: PrimInt> Default for OptionalNodeIndex<IndexType>
impl<IndexType: PrimInt> Default for OptionalNodeIndex<IndexType>
sourceimpl<IndexType: PrimInt + Hash> From<Option<NodeIndex<IndexType>>> for OptionalNodeIndex<IndexType>
impl<IndexType: PrimInt + Hash> From<Option<NodeIndex<IndexType>>> for OptionalNodeIndex<IndexType>
sourceimpl<IndexType: PrimInt + Hash> From<OptionalNodeIndex<IndexType>> for Option<NodeIndex<IndexType>>
impl<IndexType: PrimInt + Hash> From<OptionalNodeIndex<IndexType>> for Option<NodeIndex<IndexType>>
sourcefn from(source: OptionalNodeIndex<IndexType>) -> Self
fn from(source: OptionalNodeIndex<IndexType>) -> Self
Converts to this type from the input type.
sourceimpl<IndexType: PrimInt> From<usize> for OptionalNodeIndex<IndexType>
impl<IndexType: PrimInt> From<usize> for OptionalNodeIndex<IndexType>
sourceimpl<IndexType: PrimInt + Hash> GraphIndex<OptionalNodeIndex<IndexType>> for NodeIndex<IndexType>
impl<IndexType: PrimInt + Hash> GraphIndex<OptionalNodeIndex<IndexType>> for NodeIndex<IndexType>
sourceimpl<IndexType: Hash + Sized> Hash for OptionalNodeIndex<IndexType>
impl<IndexType: Hash + Sized> Hash for OptionalNodeIndex<IndexType>
sourceimpl<IndexType: PrimInt + Hash> OptionalGraphIndex<NodeIndex<IndexType>> for OptionalNodeIndex<IndexType>
impl<IndexType: PrimInt + Hash> OptionalGraphIndex<NodeIndex<IndexType>> for OptionalNodeIndex<IndexType>
sourcefn as_usize(self) -> Option<usize>
fn as_usize(self) -> Option<usize>
Get this index as usize, but return None if this index is marked as invalid.
sourcefn as_usize_unchecked(self) -> usize
fn as_usize_unchecked(self) -> usize
A faster method to get the usize value of the index, which does not perform any validity checks.
sourceimpl<IndexType: Ord + Sized> Ord for OptionalNodeIndex<IndexType>
impl<IndexType: Ord + Sized> Ord for OptionalNodeIndex<IndexType>
sourceimpl<IndexType: PartialEq + Sized> PartialEq<OptionalNodeIndex<IndexType>> for OptionalNodeIndex<IndexType>
impl<IndexType: PartialEq + Sized> PartialEq<OptionalNodeIndex<IndexType>> for OptionalNodeIndex<IndexType>
sourcefn eq(&self, other: &OptionalNodeIndex<IndexType>) -> bool
fn eq(&self, other: &OptionalNodeIndex<IndexType>) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &OptionalNodeIndex<IndexType>) -> bool
fn ne(&self, other: &OptionalNodeIndex<IndexType>) -> bool
This method tests for !=.
sourceimpl<IndexType: PartialOrd + Sized> PartialOrd<OptionalNodeIndex<IndexType>> for OptionalNodeIndex<IndexType>
impl<IndexType: PartialOrd + Sized> PartialOrd<OptionalNodeIndex<IndexType>> for OptionalNodeIndex<IndexType>
sourcefn partial_cmp(&self, other: &OptionalNodeIndex<IndexType>) -> Option<Ordering>
fn partial_cmp(&self, other: &OptionalNodeIndex<IndexType>) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl<IndexType: Copy + Sized> Copy for OptionalNodeIndex<IndexType>
impl<IndexType: Eq + Sized> Eq for OptionalNodeIndex<IndexType>
impl<IndexType: Sized> StructuralEq for OptionalNodeIndex<IndexType>
impl<IndexType: Sized> StructuralPartialEq for OptionalNodeIndex<IndexType>
Auto Trait Implementations
impl<IndexType> RefUnwindSafe for OptionalNodeIndex<IndexType> where
IndexType: RefUnwindSafe,
impl<IndexType> Send for OptionalNodeIndex<IndexType> where
IndexType: Send,
impl<IndexType> Sync for OptionalNodeIndex<IndexType> where
IndexType: Sync,
impl<IndexType> Unpin for OptionalNodeIndex<IndexType> where
IndexType: Unpin,
impl<IndexType> UnwindSafe for OptionalNodeIndex<IndexType> where
IndexType: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key and return true if they are equal.