bevy/crates/bevy_render/src/render_graph
Torstein Grindvik daa57fe489 Add try_* to add_slot_edge, add_node_edge (#6720)
# Objective

`add_node_edge` and `add_slot_edge` are fallible methods, but are always used with `.unwrap()`.
`input_node` is often unwrapped as well.
This points to having an infallible behaviour as default, with an alternative fallible variant if needed.

Improves readability and ergonomics.

## Solution

- Change `add_node_edge` and `add_slot_edge` to panic on error.
- Change `input_node` to panic on `None`.
- Add `try_add_node_edge` and `try_add_slot_edge` in case fallible methods are needed.
- Add `get_input_node` to still be able to get an `Option`.
---

## Changelog

### Added

- `try_add_node_edge`
- `try_add_slot_edge`
- `get_input_node`

### Changed

- `add_node_edge` is now infallible (panics on error)
- `add_slot_edge` is now infallible (panics on error)
- `input_node` now panics on `None`

## Migration Guide

Remove `.unwrap()` from `add_node_edge` and `add_slot_edge`.
For cases where the error was handled, use `try_add_node_edge` and `try_add_slot_edge` instead.

Remove `.unwrap()` from `input_node`.
For cases where the option was handled, use `get_input_node` instead.


Co-authored-by: Torstein Grindvik <52322338+torsteingrindvik@users.noreply.github.com>
2022-11-21 21:58:39 +00:00
..
context.rs Add try_* to add_slot_edge, add_node_edge (#6720) 2022-11-21 21:58:39 +00:00
edge.rs Clippy improvements (#4665) 2022-05-31 01:38:07 +00:00
graph.rs Add try_* to add_slot_edge, add_node_edge (#6720) 2022-11-21 21:58:39 +00:00
mod.rs bevy_render: Support removal of nodes, edges, subgraphs (#3048) 2022-03-21 23:58:37 +00:00
node.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
node_slot.rs fix nightly clippy warnings (#6395) 2022-10-28 21:03:01 +00:00