Trait Path

Source
pub trait Path<N>:
    Clone
    + Eq
    + PartialEq
    + Deref<Target = [N]>
    + IntoIterator<Item = N>
where N: Into<PathAddress> + Copy,
{ // Required method fn invert(self) -> Option<Self>; // Provided methods fn hops(&self) -> &[N] { ... } fn num_hops(&self) -> usize { ... } fn contains_cycle(&self) -> bool { ... } }
Expand description

Base implementation of an abstract path.

Required Methods§

Source

fn invert(self) -> Option<Self>

Returns the path with the hops in reverse order if it is possible.

Provided Methods§

Source

fn hops(&self) -> &[N]

Individual hops in the path. There must be always at least one hop.

Source

fn num_hops(&self) -> usize

Shorthand for the number of hops.

Source

fn contains_cycle(&self) -> bool

Checks if the path contains some entry twice.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: Into<PathAddress> + Copy + PartialEq + Eq> Path<T> for Vec<T>

Source§

fn invert(self) -> Option<Self>

Implementors§

Source§

impl Path<Address> for ChainPath

Source§

impl Path<OffchainPublicKey> for TransportPath

Source§

impl Path<OffchainPublicKey> for ValidatedPath