#[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]Cycle
The graph has a dependency cycle.
Fields
This variant is marked as non-exhaustive
#[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]UnknownDependency
A dependency on a task that is not registered.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]DuplicateTask
A task name is registered twice.
Fields
This variant is marked as non-exhaustive
#[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]MissingResource
A task declared a resource that is not in Resources.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]UndeclaredAccess
A task accessed a resource without declaring that access.
Fields
This variant is marked as non-exhaustive
#[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]TaskFailed
A task returned an error.
Fields
This variant is marked as non-exhaustive
#[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
Job(JobError)
A job pool error.
Trait Implementations§
Source§impl Clone for GraphError
impl Clone for GraphError
Source§impl Debug for GraphError
impl Debug for GraphError
Source§impl Display for GraphError
impl Display for GraphError
impl Eq for GraphError
Source§impl Error for GraphError
impl Error for GraphError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()