Skip to main content

Path

Trait Path 

pub trait Path<N>:
    Clone
    + Eq
    + PartialEq
    + Deref<Target = [N]>
    + IntoIterator<Item = N>
where N: Into<NodeId> + 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§

fn invert(self) -> Option<Self>

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

Provided Methods§

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

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

fn num_hops(&self) -> usize

Shorthand for the number of hops.

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§

§

impl<T> Path<T> for Vec<T>
where T: Into<NodeId> + Copy + PartialEq + Eq,

§

fn invert(self) -> Option<Vec<T>>

Implementors§