bevy/crates/bevy_ui/src
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
..
flex Prepare for upcoming rustlang by fixing upcoming clippy warnings (#6376) 2022-10-26 19:15:15 +00:00
render Add try_* to add_slot_edge, add_node_edge (#6720) 2022-11-21 21:58:39 +00:00
widget Remove ImageMode (#6674) 2022-11-18 21:16:32 +00:00
camera_config.rs ExtractComponent output optional associated type (#6699) 2022-11-21 13:19:44 +00:00
focus.rs Fix panic when the primary window is closed (#6545) 2022-11-12 01:28:31 +00:00
geometry.rs Make function Size::new const for bevy_ui widgets (#6602) 2022-11-14 23:08:29 +00:00
lib.rs Remove ImageMode (#6674) 2022-11-18 21:16:32 +00:00
node_bundles.rs Remove ImageMode (#6674) 2022-11-18 21:16:32 +00:00
stack.rs Add z-index support with a predictable UI stack (#5877) 2022-11-02 22:06:04 +00:00
ui_node.rs Flip UI image (#6292) 2022-11-14 21:59:17 +00:00
update.rs Add z-index support with a predictable UI stack (#5877) 2022-11-02 22:06:04 +00:00