Skip to main content

Link

Struct Link 

Source
#[repr(C)]
pub struct Link<T: LinkReference> { pub index: T, pub source: T, pub target: T, }
Expand description

A link triple (index, source, target) that represents one node in the doublets graph.

Every link is uniquely identified by its index and connects a source to a target.

Fields§

§index: T

Unique identifier of this link within the store.

§source: T

The source (left) endpoint of this link.

§target: T

The target (right) endpoint of this link.

Implementations§

Source§

impl<T: LinkReference> Link<T>

Source

pub fn nothing() -> Self

Returns a default/null link with all fields set to zero.

Source

pub const fn new(index: T, source: T, target: T) -> Self

Creates a new link with the given index, source, and target.

Source

pub const fn point(val: T) -> Self

Creates a self-referential (point) link where index == source == target.

Source

pub const fn from_slice(slice: &[T]) -> Self

Constructs a Link from the first three elements of slice.

§Panics

Panics if slice.len() < 3.

Source

pub fn is_null(&self) -> bool

Returns true if this is the null (zero) link.

Source

pub fn is_full(&self) -> bool

Returns true if the link is a full point (index == source == target).

Source

pub fn is_partial(&self) -> bool

Returns true if index equals either source or target.

Source

pub const fn as_slice(&self) -> &[T]

Returns the link fields as a three-element slice [index, source, target].

Trait Implementations§

Source§

impl<T: Clone + LinkReference> Clone for Link<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: LinkReference> Debug for Link<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default + LinkReference> Default for Link<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: Eq + LinkReference> Eq for Link<T>

Source§

impl<T: Hash + LinkReference> Hash for Link<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: PartialEq + LinkReference> PartialEq for Link<T>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T: PartialEq + LinkReference> StructuralPartialEq for Link<T>

Source§

impl<T: LinkReference> ToQuery<T> for Link<T>

Source§

fn to_query(&self) -> Query<'_, T>

Auto Trait Implementations§

§

impl<T> Freeze for Link<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Link<T>
where T: RefUnwindSafe,

§

impl<T> Send for Link<T>

§

impl<T> Sync for Link<T>

§

impl<T> Unpin for Link<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Link<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Link<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.