#[repr(C)]pub struct Link<S, K, Ix = usize>{ /* private fields */ }
Expand description
Implementations§
Source§impl<S, K, Ix> Link<S, K, Ix>
impl<S, K, Ix> Link<S, K, Ix>
Sourcepub const fn new(id: EdgeId<Ix>, domain: S) -> Self
pub const fn new(id: EdgeId<Ix>, domain: S) -> Self
returns a new instance using the given edge id and domain
Sourcepub fn from_domain(nodes: S) -> Selfwhere
Ix: Default,
pub fn from_domain(nodes: S) -> Selfwhere
Ix: Default,
creates a new edge with the given nodes
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 with_id(self, id: EdgeId<Ix>) -> Self
pub fn with_id(self, id: EdgeId<Ix>) -> Self
consumes the current instance to create another with the given id.
Sourcepub fn with_domain<S2: Domain<Ix>>(self, nodes: S2) -> Link<S2, K, Ix>
pub fn with_domain<S2: Domain<Ix>>(self, nodes: S2) -> Link<S2, K, Ix>
consumes the current instance to create another with the given nodes.
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
Source§impl<S, Idx> Link<S, Undirected, Idx>
impl<S, Idx> Link<S, Undirected, Idx>
Sourcepub fn undirected(id: EdgeId<Idx>, nodes: S) -> Self
pub fn undirected(id: EdgeId<Idx>, nodes: S) -> Self
creates a new Undirected
hyperedge with the given id and nodes
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<S, I, K> BinaryLayout for Link<S, K, I>
impl<S, I, K> BinaryLayout for Link<S, K, I>
Source§impl<S, K, Idx> BorrowMut<IndexBase<Idx, EdgeIndex>> for Link<S, K, Idx>
impl<S, K, Idx> BorrowMut<IndexBase<Idx, EdgeIndex>> for Link<S, K, Idx>
Source§fn borrow_mut(&mut self) -> &mut EdgeId<Idx>
fn borrow_mut(&mut self) -> &mut EdgeId<Idx>
Source§impl<'de, S, K, Ix> Deserialize<'de> for Link<S, K, Ix>
impl<'de, S, K, Ix> Deserialize<'de> for Link<S, K, Ix>
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<S, K, Idx> FromIterator<Idx> for Link<S, K, Idx>
impl<S, K, Idx> FromIterator<Idx> for Link<S, K, Idx>
Source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = Idx>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = Idx>,
Source§impl<S, K, Idx> FromIterator<IndexBase<Idx>> for Link<S, K, Idx>
impl<S, K, Idx> FromIterator<IndexBase<Idx>> for Link<S, K, Idx>
Source§impl<S, K: Ord, Ix: Ord> Ord for Link<S, K, Ix>
impl<S, K: Ord, Ix: Ord> Ord for Link<S, K, Ix>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<S, K: PartialOrd, Ix: PartialOrd> PartialOrd for Link<S, K, Ix>
impl<S, K: PartialOrd, Ix: PartialOrd> PartialOrd for Link<S, K, Ix>
Source§impl<S, K, Idx> RawLayout for Link<S, K, Idx>
impl<S, K, Idx> RawLayout for Link<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
impl<S, K: Copy, Ix: Copy> Copy for Link<S, K, Ix>
impl<S, K: Eq, Ix: Eq> Eq for Link<S, K, Ix>
impl<S, K, Ix> StructuralPartialEq for Link<S, K, Ix>
Auto Trait Implementations§
impl<S, K, Ix> Freeze for Link<S, K, Ix>
impl<S, K, Ix> RefUnwindSafe for Link<S, K, Ix>
impl<S, K, Ix> Send for Link<S, K, Ix>
impl<S, K, Ix> Sync for Link<S, K, Ix>
impl<S, K, Ix> Unpin for Link<S, K, Ix>
impl<S, K, Ix> UnwindSafe for Link<S, K, Ix>
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
.