Skip to main content

GraphError

Enum GraphError 

Source
#[non_exhaustive]
pub enum GraphError {
#[non_exhaustive]
Cycle { tasks: Vec<String>, },
#[non_exhaustive]
AmbiguousOrder { a: String, b: String, resource: String, },
#[non_exhaustive]
UnknownDependency { task: String, missing: String, },
#[non_exhaustive]
DuplicateTask { task: String, },
#[non_exhaustive]
TooLarge { tasks: usize, reason: &'static str, },
#[non_exhaustive]
MissingResource { task: String, resource: String, },
#[non_exhaustive]
UndeclaredAccess { task: String, resource: String, access: &'static str, },
#[non_exhaustive]
BorrowConflict { task: String, resource: String, },
#[non_exhaustive]
TaskFailed { task: String, message: String, },
#[non_exhaustive]
TaskPanicked { task: String, message: String, }, Job(JobError), }
Expand description

Errors of building and running the graph.

Build errors (FrameGraphBuilder::build) are returned before the first frame and name the tasks; frame errors (FrameGraph::run) are the first error of the task with the lowest registration index, so with identical failures the result does not depend on thread scheduling.

The enum and its variants are #[non_exhaustive]: match with .. and a wildcard arm. Inside a task, ? on a GraphError (for example from TaskContext::read) passes it through unchanged.

use pragma_graph::{FrameGraph, GraphError};

struct Bodies;

let mut g = FrameGraph::builder();
g.task("physics", |t| t.writes::<Bodies>(), |_| ());
g.task("debug draw", |t| t.reads::<Bodies>(), |_| ());
match g.build() {
    Err(GraphError::AmbiguousOrder { a, b, .. }) => {
        // Fix: `.after("physics")` on "debug draw", or `FrameGraph::builder().ordered()`.
        assert_eq!((a.as_str(), b.as_str()), ("physics", "debug draw"));
    }
    other => panic!("unexpected {other:?}"),
}

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

#[non_exhaustive]
Cycle

The graph has a dependency cycle.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§tasks: Vec<String>

The tasks forming the cycle, in edge order (an edge leads from the last one to the first).

§

#[non_exhaustive]
AmbiguousOrder

Two tasks write (or write/read) the same resource without an explicit order.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§a: String

The first task (in registration order).

§b: String

The second task.

§resource: String

The conflicting resource.

§

#[non_exhaustive]
UnknownDependency

A dependency on a task that is not registered.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§task: String

The task with the dependency.

§missing: String

The missing task.

§

#[non_exhaustive]
DuplicateTask

A task name is registered twice.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§task: String

The repeated name.

§

#[non_exhaustive]
TooLarge

The graph does not fit the build limits (MAX_TASKS, MAX_EDGES) or memory for the plan could not be allocated; returned instead of an abort on a large input.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§tasks: usize

Number of tasks in the description.

§reason: &'static str

Which limit was exceeded (or out of memory).

§

#[non_exhaustive]
MissingResource

A task declared a resource that is not in Resources.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§task: String

The first task that declared the resource.

§resource: String

The resource.

§

#[non_exhaustive]
UndeclaredAccess

A task accessed a resource without declaring that access.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§task: String

The task.

§resource: String

The resource.

§access: &'static str

"read" or "write".

§

#[non_exhaustive]
BorrowConflict

The resource is already borrowed (for example a task took it for writing twice).

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§task: String

The task.

§resource: String

The resource.

§

#[non_exhaustive]
TaskFailed

A task returned an error.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§task: String

The task.

§message: String

The error text.

§

#[non_exhaustive]
TaskPanicked

A task panicked; the panic was caught, and the dependent tasks of this frame did not run.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§task: String

The task.

§message: String

The panic message, if it was a string.

§

Job(JobError)

A job pool error.

Trait Implementations§

Source§

impl Clone for GraphError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for GraphError

Source§

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

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

impl Display for GraphError

Source§

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

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

impl Eq for GraphError

Source§

impl Error for GraphError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<JobError> for GraphError

Source§

fn from(source: JobError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for GraphError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for GraphError

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> 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> 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.
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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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