#[repr(C)]pub struct Edge<T, S, K, Idx = Udx>{ /* private fields */ }
Implementations§
Source§impl<T, S, K, Idx> Edge<T, S, K, Idx>
impl<T, S, K, Idx> Edge<T, S, K, Idx>
Sourcepub const fn new(edge: Link<S, K, Idx>, weight: Weight<T>) -> Self
pub const fn new(edge: Link<S, K, Idx>, weight: Weight<T>) -> Self
creates a new instance from the given edge and weight
Sourcepub fn from_parts(id: EdgeId<Idx>, nodes: S, weight: Weight<T>) -> Self
pub fn from_parts(id: EdgeId<Idx>, nodes: S, weight: Weight<T>) -> Self
create a new instance of the Edge
from the given id, nodes, and weight
Sourcepub fn from_domain(nodes: S) -> Self
pub fn from_domain(nodes: S) -> Self
creates a new edge with the given nodes
Sourcepub fn from_link(edge: Link<S, K, Idx>) -> Selfwhere
T: Default,
pub fn from_link(edge: Link<S, K, Idx>) -> Selfwhere
T: Default,
creates a new edge with the given id
Sourcepub fn from_weight(weight: Weight<T>) -> Self
pub fn from_weight(weight: Weight<T>) -> Self
creates a new instance from the given value
Sourcepub const fn link_mut(&mut self) -> &mut Link<S, K, Idx>
pub const fn link_mut(&mut self) -> &mut Link<S, K, Idx>
returns a mutable reference to the edge
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 weight
Sourcepub const fn domain_mut(&mut self) -> &mut S
pub const fn domain_mut(&mut self) -> &mut S
returns a mutable reference to the nodes
Sourcepub fn set_domain(&mut self, nodes: S) -> &mut Self
pub fn set_domain(&mut self, nodes: S) -> &mut Self
updates the nodes and returns a mutable reference to the instance
Sourcepub fn set_link(&mut self, link: Link<S, K, Idx>) -> &mut Self
pub fn set_link(&mut self, link: Link<S, K, Idx>) -> &mut Self
updates the link and returns a mutable reference to the instance
Sourcepub fn set_weight(&mut self, weight: Weight<T>) -> &mut Self
pub fn set_weight(&mut self, weight: Weight<T>) -> &mut Self
updates the weight and returns a mutable reference to the instance
Sourcepub fn with_id(self, id: EdgeId<Idx>) -> Self
pub fn with_id(self, id: EdgeId<Idx>) -> Self
consumes the current instance to create another with the given id.
Sourcepub fn with_domain<S2: Domain<Idx>>(self, nodes: S2) -> Edge<T, S2, K, Idx>
pub fn with_domain<S2: Domain<Idx>>(self, nodes: S2) -> Edge<T, S2, K, Idx>
consumes the current instance to create another with the given nodes.
Sourcepub fn with_weight<U>(self, weight: Weight<U>) -> Edge<U, S, K, Idx>
pub fn with_weight<U>(self, weight: Weight<U>) -> Edge<U, S, K, Idx>
consumes the current instance to create another with the given weight.
Source§impl<T, S, I> Edge<T, S, Undirected, I>
impl<T, S, I> Edge<T, S, Undirected, I>
Sourcepub fn undirected(id: EdgeId<I>, nodes: S, weight: T) -> Self
pub fn undirected(id: EdgeId<I>, nodes: S, weight: T) -> Self
creates a new Undirected
hypersurface with the given id and nodes
Methods from Deref<Target = Link<S, K, Idx>>§
Sourcepub fn domain_mut(&mut self) -> &mut S
pub fn domain_mut(&mut self) -> &mut S
returns a mutable reference to the nodes
Sourcepub fn set_domain(&mut self, nodes: S) -> &mut Self
pub fn set_domain(&mut self, nodes: S) -> &mut Self
updates the nodes and returns a mutable reference to the instance
Sourcepub fn contains<Q>(&self, index: &Q) -> bool
pub fn contains<Q>(&self, index: &Q) -> bool
returns true if the edge contains the given vertex index
Sourcepub fn contains_all<Q, I>(&self, indices: I) -> boolwhere
Ix: PartialEq,
I: IntoIterator<Item = Q>,
Q: PartialEq,
VertexId<Ix>: Borrow<Q>,
for<'a> &'a S: IntoIterator<Item = &'a VertexId<Ix>>,
pub fn contains_all<Q, I>(&self, indices: I) -> boolwhere
Ix: PartialEq,
I: IntoIterator<Item = Q>,
Q: PartialEq,
VertexId<Ix>: Borrow<Q>,
for<'a> &'a S: IntoIterator<Item = &'a VertexId<Ix>>,
returns true if the edge contains all the given vertex indices
Methods from Deref<Target = EdgeId<Idx>>§
Sourcepub fn as_mut_ptr(&mut self) -> *mut T
pub fn as_mut_ptr(&mut self) -> *mut T
returns a mutable pointer to the inner value
Sourcepub fn as_raw_box(&self) -> Box<dyn RawIndex>where
T: Clone,
pub fn as_raw_box(&self) -> Box<dyn RawIndex>where
T: Clone,
converts the a reference to a boxed raw index trait object
Sourcepub fn replace(&mut self, index: T) -> T
pub fn replace(&mut self, index: T) -> T
replace
and return the old value after replacing it with the
given value
Sourcepub fn take(&mut self) -> Twhere
T: Default,
pub fn take(&mut self) -> Twhere
T: Default,
take
the value and replace it with the default value
Sourcepub fn dec_inplace(&mut self)
pub fn dec_inplace(&mut self)
mutably decrements the index value by one
Sourcepub fn inc_inplace(&mut self)
pub fn inc_inplace(&mut self)
mutably increments the index value by 1
Sourcepub fn step(&mut self) -> IndexResult<Self>where
T: AddStep<Output = T>,
pub fn step(&mut self) -> IndexResult<Self>where
T: AddStep<Output = T>,
increments the current index and returns the previous instance of the index.
use rshyper_core::EdgeId;
let mut edge_id = EdgeId::<usize>::zero();
let e0 = edge_id.step()?;
let e1 = edge_id.step()?;
let e2 = edge_id.step()?;
assert_eq!(e0.get(), &0);
assert_eq!(e1.get(), &1);
assert_eq!(e2.get(), &2);
Sourcepub fn step_with<F>(&mut self, f: F) -> IndexResult<Self>
pub fn step_with<F>(&mut self, f: F) -> IndexResult<Self>
replaces the current value with the next one computed using the provided function and returns the previous instance of the index.
Sourcepub fn rand_step(&mut self) -> Selfwhere
StandardUniform: Distribution<T>,
pub fn rand_step(&mut self) -> Selfwhere
StandardUniform: Distribution<T>,
replaces the current value with a randomly generated value and returns a new instance
of IndexBase
with the previous value.
Sourcepub fn atomic_next(&mut self) -> Self
pub fn atomic_next(&mut self) -> Self
atomically generates a the next index, replacing the current value with the generated one and returning the previous value.
Sourcepub fn generate(&mut self) -> Self
pub fn generate(&mut self) -> Self
the generate
is useful for instances where the type Idx
of
the IndexBase
is not generalized, automatically using random number generation
if the rand
feature is enabled, or an atomic counter otherwise. The method is also
useful in that it generates usize
indices, whcih are the most common instances, yet
aren’t direct implementors of StandardUniform
.
Trait Implementations§
Source§impl<E, S, I, K> BinaryLayout for Edge<E, S, K, I>
impl<E, S, I, K> BinaryLayout for Edge<E, S, K, I>
Source§impl<T, S, K, Idx> BorrowMut<IndexBase<Idx, EdgeIndex>> for Edge<T, S, K, Idx>
impl<T, S, K, Idx> BorrowMut<IndexBase<Idx, EdgeIndex>> for Edge<T, S, K, Idx>
Source§fn borrow_mut(&mut self) -> &mut EdgeId<Idx>
fn borrow_mut(&mut self) -> &mut EdgeId<Idx>
Source§impl<'de, T, S, K, Idx> Deserialize<'de> for Edge<T, S, K, Idx>where
S: RawDomain<Key = VertexId<Idx>> + Deserialize<'de>,
T: Deserialize<'de>,
K: Deserialize<'de>,
Idx: Deserialize<'de>,
impl<'de, T, S, K, Idx> Deserialize<'de> for Edge<T, S, K, Idx>where
S: RawDomain<Key = VertexId<Idx>> + Deserialize<'de>,
T: Deserialize<'de>,
K: Deserialize<'de>,
Idx: 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: Ord, S, K: Ord, Idx: Ord> Ord for Edge<T, S, K, Idx>
impl<T: Ord, S, K: Ord, Idx: Ord> Ord for Edge<T, S, K, Idx>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<T: PartialOrd, S, K: PartialOrd, Idx: PartialOrd> PartialOrd for Edge<T, S, K, Idx>
impl<T: PartialOrd, S, K: PartialOrd, Idx: PartialOrd> PartialOrd for Edge<T, S, K, Idx>
Source§impl<T, S, Idx, K> RawLayout for Edge<T, S, K, Idx>
impl<T, S, Idx, K> RawLayout for Edge<T, S, K, Idx>
type Kind = K
type Index = Idx
type Store = S
Source§fn domain_mut(&mut self) -> &mut S
fn domain_mut(&mut self) -> &mut S
Source§fn is_directed(&self) -> bool
fn is_directed(&self) -> bool
Source§fn is_undirected(&self) -> bool
fn is_undirected(&self) -> bool
Source§impl<T, S, Idx, K> RawSurface<T> for Edge<T, S, K, Idx>
impl<T, S, Idx, K> RawSurface<T> for Edge<T, S, K, Idx>
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 edge 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 edge with another weightimpl<T: Copy, S, K: Copy, Idx: Copy> Copy for Edge<T, S, K, Idx>
impl<T: Eq, S, K: Eq, Idx: Eq> Eq for Edge<T, S, K, Idx>
impl<T, S, K, Idx> StructuralPartialEq for Edge<T, S, K, Idx>
Auto Trait Implementations§
impl<T, S, K, Idx> Freeze for Edge<T, S, K, Idx>
impl<T, S, K, Idx> RefUnwindSafe for Edge<T, S, K, Idx>
impl<T, S, K, Idx> Send for Edge<T, S, K, Idx>
impl<T, S, K, Idx> Sync for Edge<T, S, K, Idx>
impl<T, S, K, Idx> Unpin for Edge<T, S, K, Idx>
impl<T, S, K, Idx> UnwindSafe for Edge<T, S, K, Idx>
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
.