Skip to main content

TaskGraph

Struct TaskGraph 

Source
pub struct TaskGraph { /* private fields */ }
Expand description

A fine-grained task dependency graph built from the project graph.

Expands project-level dependencies into target-level task dependencies, resolving local and upstream (^) dependency references.

Implementations§

Source§

impl TaskGraph

Source

pub fn build( project_graph: &ProjectGraph, target: &TargetName, ) -> Result<Self, TaskGraphError>

Build a task graph from a project graph for the given target.

This expands the project-level DAG into a fine-grained task-level DAG, resolving all depends_on references in each target configuration.

Source

pub fn ready_tasks(&self) -> Vec<&TaskId>

Get all tasks that are ready to execute.

Source

pub fn mark_complete( &mut self, task_id: &TaskId, ) -> Result<Vec<TaskId>, TaskGraphError>

Mark a task as complete and return the tasks that became ready.

Source

pub fn mark_running(&mut self, task_id: &TaskId) -> Result<(), TaskGraphError>

Mark a task as running.

Source

pub fn state(&self, task_id: &TaskId) -> Option<TaskState>

Get the state of a task.

Source

pub fn tasks(&self) -> impl Iterator<Item = &TaskId>

Get all tasks in the graph.

Source

pub fn dependencies_of(&self, task_id: &TaskId) -> Option<&HashSet<TaskId>>

Get the direct dependencies of a task.

Source

pub fn len(&self) -> usize

Get the number of tasks in the graph.

Source

pub fn is_empty(&self) -> bool

Returns true if the graph has no tasks.

Source

pub fn all_completed(&self) -> bool

Check if all tasks are completed.

Trait Implementations§

Source§

impl Debug for TaskGraph

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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, 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> Same for T

Source§

type Output = T

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