Struct cargo::util::DependencyQueue

source ·
pub struct DependencyQueue<N: Hash + Eq, E: Hash + Eq, V> { /* private fields */ }

Implementations§

source§

impl<N: Hash + Eq, E: Hash + Eq, V> DependencyQueue<N, E, V>

source

pub fn new() -> DependencyQueue<N, E, V>

Creates a new dependency queue with 0 packages.

source§

impl<N: Hash + Eq + Clone, E: Eq + Hash + Clone, V> DependencyQueue<N, E, V>

source

pub fn queue( &mut self, key: N, value: V, dependencies: impl IntoIterator<Item = (N, E)>, cost: usize )

Adds a new node and its dependencies to this queue.

The key specified is a new node in the dependency graph, and the node depend on all the dependencies iterated by dependencies. Each dependency is a node/edge pair, where edges can be thought of as productions from nodes (aka if it’s just () it’s just waiting for the node to finish).

An optional value can also be associated with key which is reclaimed when the node is ready to go.

The cost parameter can be used to hint at the relative cost of building this node. This implementation does not care about the units of this value, so the calling code is free to use whatever they’d like. In general, higher cost nodes are expected to take longer to build.

source

pub fn queue_finished(&mut self)

All nodes have been added, calculate some internal metadata and prepare for dequeue.

source

pub fn dequeue(&mut self) -> Option<(N, V, usize)>

Dequeues a package that is ready to be built.

A package is ready to be built when it has 0 un-built dependencies. If None is returned then no packages are ready to be built.

source

pub fn is_empty(&self) -> bool

Returns true if there are remaining packages to be built.

source

pub fn len(&self) -> usize

Returns the number of remaining packages to be built.

source

pub fn finish(&mut self, node: &N, edge: &E) -> Vec<&N>

Indicate that something has finished.

Calling this function indicates that the node has produced edge. All remaining work items which only depend on this node/edge pair are now candidates to start their job.

Returns the nodes that are now allowed to be dequeued as a result of finishing this node.

Trait Implementations§

source§

impl<N: Debug + Hash + Eq, E: Debug + Hash + Eq, V: Debug> Debug for DependencyQueue<N, E, V>

source§

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

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

impl<N: Hash + Eq, E: Hash + Eq, V> Default for DependencyQueue<N, E, V>

source§

fn default() -> DependencyQueue<N, E, V>

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

Auto Trait Implementations§

§

impl<N, E, V> Freeze for DependencyQueue<N, E, V>

§

impl<N, E, V> RefUnwindSafe for DependencyQueue<N, E, V>

§

impl<N, E, V> Send for DependencyQueue<N, E, V>
where E: Send, N: Send, V: Send,

§

impl<N, E, V> Sync for DependencyQueue<N, E, V>
where E: Sync, N: Sync, V: Sync,

§

impl<N, E, V> Unpin for DependencyQueue<N, E, V>
where E: Unpin, N: Unpin, V: Unpin,

§

impl<N, E, V> UnwindSafe for DependencyQueue<N, E, V>
where E: UnwindSafe, N: UnwindSafe, V: 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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
§

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

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more