hopr_path::path

Trait Path

Source
pub trait Path<N>:
    Display
    + Clone
    + Eq
    + PartialEq
where N: Copy + Clone + Eq + PartialEq + Hash,
{ // Required method fn hops(&self) -> &[N]; // Provided methods fn length(&self) -> usize { ... } fn last_hop(&self) -> &N { ... } fn contains_cycle(&self) -> bool { ... } }
Expand description

Base implementation of an abstract path. Must contain always at least a single entry.

Required Methods§

Source

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

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

Provided Methods§

Source

fn length(&self) -> usize

Shorthand for number of hops.

Source

fn last_hop(&self) -> &N

Gets the last hop

Source

fn contains_cycle(&self) -> bool

Checks if all the hops in this path are to distinct addresses. Returns true if there are duplicate Addresses on this path. Note that the duplicate Addresses can never be adjacent.

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.

Implementors§