mirror of
https://github.com/bevyengine/bevy
synced 2025-01-03 08:48:57 +00:00
f000c2b951
# Objective Follow up to my previous MR #3718 to add new clippy warnings to bevy: - [x] [~~option_if_let_else~~](https://rust-lang.github.io/rust-clippy/master/#option_if_let_else) (reverted) - [x] [redundant_else](https://rust-lang.github.io/rust-clippy/master/#redundant_else) - [x] [match_same_arms](https://rust-lang.github.io/rust-clippy/master/#match_same_arms) - [x] [semicolon_if_nothing_returned](https://rust-lang.github.io/rust-clippy/master/#semicolon_if_nothing_returned) - [x] [explicit_iter_loop](https://rust-lang.github.io/rust-clippy/master/#explicit_iter_loop) - [x] [map_flatten](https://rust-lang.github.io/rust-clippy/master/#map_flatten) There is one commit per clippy warning, and the matching flags are added to the CI execution. To test the CI execution you may run `cargo run -p ci -- clippy` at the root. I choose the add the flags in the `ci` tool crate to avoid having them in every `lib.rs` but I guess it could become an issue with suprise warnings coming up after a commit/push Co-authored-by: Carter Anderson <mcanders1@gmail.com>
54 lines
1.9 KiB
Rust
54 lines
1.9 KiB
Rust
use super::NodeId;
|
|
|
|
/// An edge, which connects two [`Nodes`](super::Node) in
|
|
/// a [`RenderGraph`](crate::render_graph::RenderGraph).
|
|
///
|
|
/// They are used to describe the ordering (which node has to run first)
|
|
/// and may be of two kinds: [`NodeEdge`](Self::NodeEdge) and [`SlotEdge`](Self::SlotEdge).
|
|
///
|
|
/// Edges are added via the `render_graph::add_node_edge(output_node, input_node)` and the
|
|
/// `render_graph::add_slot_edge(output_node, output_slot, input_node, input_slot)` methods.
|
|
///
|
|
/// The former simply states that the `output_node` has to be run before the `input_node`,
|
|
/// while the later connects an output slot of the `output_node`
|
|
/// with an input slot of the `input_node` to pass additional data along.
|
|
/// For more information see [`SlotType`](super::SlotType).
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
pub enum Edge {
|
|
/// An edge describing to ordering of both nodes (`output_node` before `input_node`)
|
|
/// and connecting the output slot at the `output_index` of the output_node
|
|
/// with the slot at the `input_index` of the `input_node`.
|
|
SlotEdge {
|
|
input_node: NodeId,
|
|
input_index: usize,
|
|
output_node: NodeId,
|
|
output_index: usize,
|
|
},
|
|
/// An edge describing to ordering of both nodes (`output_node` before `input_node`).
|
|
NodeEdge {
|
|
input_node: NodeId,
|
|
output_node: NodeId,
|
|
},
|
|
}
|
|
|
|
impl Edge {
|
|
/// Returns the id of the `input_node`.
|
|
pub fn get_input_node(&self) -> NodeId {
|
|
match self {
|
|
Edge::SlotEdge { input_node, .. } | Edge::NodeEdge { input_node, .. } => *input_node,
|
|
}
|
|
}
|
|
|
|
/// Returns the id of the `output_node`.
|
|
pub fn get_output_node(&self) -> NodeId {
|
|
match self {
|
|
Edge::SlotEdge { output_node, .. } | Edge::NodeEdge { output_node, .. } => *output_node,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(PartialEq, Eq)]
|
|
pub enum EdgeExistence {
|
|
Exists,
|
|
DoesNotExist,
|
|
}
|