Struct Graph

Source
pub struct Graph<N: Clone, E: Clone> { /* private fields */ }

Implementations§

Source§

impl Graph<PackageId, HashSet<Dependency>>

Source

pub fn parents_of( &self, p: PackageId, ) -> impl Iterator<Item = (PackageId, bool)> + '_

Source§

impl<N: Eq + Ord + Clone, E: Default + Clone> Graph<N, E>

Source

pub fn new() -> Graph<N, E>

Source

pub fn add(&mut self, node: N)

Source

pub fn contains<Q>(&self, k: &Q) -> bool
where N: Borrow<Q>, Q: Ord + Eq + ?Sized,

Source

pub fn edge(&self, from: &N, to: &N) -> Option<&E>

Source

pub fn edges(&self, from: &N) -> impl Iterator<Item = &(N, E)>

Source

pub fn sort(&self) -> Vec<N>

A topological sort of the Graph

Source

pub fn iter(&self) -> impl Iterator<Item = &N>

Source

pub fn is_path_from_to<'a>(&'a self, from: &'a N, to: &'a N) -> bool

Checks if there is a path from from to to.

Source

pub fn path_to_bottom<'a>(&'a self, pkg: &'a N) -> Vec<&'a N>

Resolves one of the paths from the given dependent package down to a leaf.

Source

pub fn path_to_top<'a>(&'a self, pkg: &'a N) -> Vec<&'a N>

Resolves one of the paths from the given dependent package up to the root.

Trait Implementations§

Source§

impl<N: Eq + Ord + Clone, E: Clone> Clone for Graph<N, E>

Source§

fn clone(&self) -> Graph<N, E>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<N: Display + Eq + Ord + Clone, E: Clone> Debug for Graph<N, E>

Source§

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

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

impl<N: Eq + Ord + Clone, E: Default + Clone> Default for Graph<N, E>

Source§

fn default() -> Graph<N, E>

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

impl<N: Eq + Ord + Clone, E: Eq + Clone> PartialEq for Graph<N, E>

Source§

fn eq(&self, other: &Graph<N, E>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<N: Eq + Ord + Clone, E: Eq + Clone> Eq for Graph<N, E>

Auto Trait Implementations§

§

impl<N, E> Freeze for Graph<N, E>

§

impl<N, E> RefUnwindSafe for Graph<N, E>

§

impl<N, E> !Send for Graph<N, E>

§

impl<N, E> !Sync for Graph<N, E>

§

impl<N, E> Unpin for Graph<N, E>
where N: Unpin, E: Unpin,

§

impl<N, E> UnwindSafe for Graph<N, E>

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,