#[repr(C)]pub struct Node<T, Ix = Udx> { /* private fields */ }
Implementations§
Source§impl<T, Ix> Node<T, Ix>where
Ix: RawIndex,
impl<T, Ix> Node<T, Ix>where
Ix: RawIndex,
Sourcepub const fn new(id: VertexId<Ix>, weight: T) -> Self
pub const fn new(id: VertexId<Ix>, weight: T) -> Self
initialize a new instance with the given index and weight
Sourcepub fn from_id(index: VertexId<Ix>) -> Selfwhere
T: Default,
pub fn from_id(index: VertexId<Ix>) -> Selfwhere
T: Default,
returns a new weighted node using the given value and the logical default for the index
Sourcepub fn from_weight(Weight: Weight<T>) -> Selfwhere
Ix: Default,
pub fn from_weight(Weight: Weight<T>) -> Selfwhere
Ix: Default,
creates a new node with the given index using the logical default for the weight.
Sourcepub fn with_id<I2: RawIndex>(self, index: VertexId<I2>) -> Node<T, I2>
pub fn with_id<I2: RawIndex>(self, index: VertexId<I2>) -> Node<T, I2>
consumes the current instance to create another with the given index.
Sourcepub fn with_weight<U>(self, weight: Weight<U>) -> Node<U, Ix>
pub fn with_weight<U>(self, weight: Weight<U>) -> Node<U, Ix>
consumes the current instance to create another with the given weight.
Sourcepub const fn as_tuple(&self) -> (&VertexId<Ix>, &Weight<T>)
pub const fn as_tuple(&self) -> (&VertexId<Ix>, &Weight<T>)
converts the node into a 2-tuple consisting of the node index and the weight:
0
: a reference to the node index1
: a reference to the node weight
Sourcepub fn into_tuple(self) -> (VertexId<Ix>, Weight<T>)
pub fn into_tuple(self) -> (VertexId<Ix>, Weight<T>)
consumes the node to convert it into a 2-tuple consisting of the node index and the weight
Sourcepub fn as_tuple_mut(&mut self) -> (&VertexId<Ix>, &mut Weight<T>)
pub fn as_tuple_mut(&mut self) -> (&VertexId<Ix>, &mut Weight<T>)
returns the node as a tuple with a mutable reference to the weight such that:
0
: a reference to the node index1
: a mutable reference to the node weight
this method is useful for converting the node into a standard item produced by mutable
key-value iterators where Item = (&'a K, &'a mut V)
Sourcepub const fn weight_mut(&mut self) -> &mut Weight<T>
pub const fn weight_mut(&mut self) -> &mut Weight<T>
returns a mutable reference to the node weight
Sourcepub fn set_weight(&mut self, weight: T) -> &mut Self
pub fn set_weight(&mut self, weight: T) -> &mut Self
update the weight and return a mutable reference to the current instance.
Sourcepub const fn replace_weight(&mut self, weight: T) -> Weight<T>
pub const fn replace_weight(&mut self, weight: T) -> Weight<T>
replace
the weight of the current instance with the given weight,
returning the previous weight.
Sourcepub fn swap_weight(&mut self, other: &mut Self)
pub fn swap_weight(&mut self, other: &mut Self)
swap
the weight of the current instance with the weight of
another instance.
Source§impl<T, Idx> Node<UnWeight<T>, Idx>where
Idx: RawIndex,
impl<T, Idx> Node<UnWeight<T>, Idx>where
Idx: RawIndex,
Sourcepub const fn weightless(id: VertexId<Idx>) -> Self
pub const fn weightless(id: VertexId<Idx>) -> Self
returns a new, weightless node with the given index
Sourcepub fn init_weight<F>(self, init: F) -> Node<T, Idx>where
F: FnOnce() -> T,
pub fn init_weight<F>(self, init: F) -> Node<T, Idx>where
F: FnOnce() -> T,
initialize the weight of the node with the given value
Trait Implementations§
Source§impl<T, Idx> BorrowMut<Weight<T>> for Node<T, Idx>where
Idx: RawIndex,
impl<T, Idx> BorrowMut<Weight<T>> for Node<T, Idx>where
Idx: RawIndex,
Source§fn borrow_mut(&mut self) -> &mut Weight<T>
fn borrow_mut(&mut self) -> &mut Weight<T>
Source§impl<'de, T, Ix> Deserialize<'de> for Node<T, Ix>where
T: Deserialize<'de>,
Ix: Deserialize<'de>,
impl<'de, T, Ix> Deserialize<'de> for Node<T, Ix>where
T: Deserialize<'de>,
Ix: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<T, Idx> HyperNode<T> for Node<T, Idx>where
Idx: RawIndex,
impl<T, Idx> HyperNode<T> for Node<T, Idx>where
Idx: RawIndex,
Source§fn weight_mut(&mut self) -> &mut Weight<T>
fn weight_mut(&mut self) -> &mut Weight<T>
Source§fn replace_weight(&mut self, weight: Weight<T>) -> Weight<T>
fn replace_weight(&mut self, weight: Weight<T>) -> Weight<T>
replace
the weight of the node with a new one, returning the
previous valueSource§fn set_weight(&mut self, weight: T) -> &mut Self
fn set_weight(&mut self, weight: T) -> &mut Self
Source§fn swap_weight(&mut self, weight: &mut Weight<T>)
fn swap_weight(&mut self, weight: &mut Weight<T>)
swap
the weight of the node with another weightSource§impl<T, Id> HyperPoint for Node<T, Id>where
Id: RawIndex,
impl<T, Id> HyperPoint for Node<T, Id>where
Id: RawIndex,
Source§impl<T: Ord, Ix: Ord> Ord for Node<T, Ix>
impl<T: Ord, Ix: Ord> Ord for Node<T, Ix>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<T: PartialOrd, Ix: PartialOrd> PartialOrd for Node<T, Ix>
impl<T: PartialOrd, Ix: PartialOrd> PartialOrd for Node<T, Ix>
impl<T: Copy, Ix: Copy> Copy for Node<T, Ix>
impl<T: Eq, Ix: Eq> Eq for Node<T, Ix>
impl<T, Ix> StructuralPartialEq for Node<T, Ix>
Auto Trait Implementations§
impl<T, Ix> Freeze for Node<T, Ix>
impl<T, Ix> RefUnwindSafe for Node<T, Ix>where
Ix: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, Ix> Send for Node<T, Ix>
impl<T, Ix> Sync for Node<T, Ix>
impl<T, Ix> Unpin for Node<T, Ix>
impl<T, Ix> UnwindSafe for Node<T, Ix>where
Ix: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<K, S> Identity<K> for Swhere
S: Borrow<K>,
K: Identifier,
impl<K, S> Identity<K> for Swhere
S: Borrow<K>,
K: Identifier,
Source§impl<T> IntoWeight<T> for T
impl<T> IntoWeight<T> for T
fn into_weight(self) -> Weight<T>
Source§impl<R> Rng for R
impl<R> Rng for R
Source§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
StandardUniform
distribution. Read moreSource§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
Source§fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Source§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
p
of being true. Read moreSource§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
numerator/denominator
of being
true. Read moreSource§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Source§fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
Source§fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
random
to avoid conflict with the new gen
keyword in Rust 2024.Rng::random
.Source§fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
random_range
Rng::random_range
.Source§impl<R> TryRngCore for R
impl<R> TryRngCore for R
Source§type Error = Infallible
type Error = Infallible
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
u32
.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
u64
.Source§fn try_fill_bytes(
&mut self,
dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
dest
entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
UnwrapMut
wrapper.Source§fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
RngCore
to a RngReadAdapter
.