bevy/crates/bevy_utils/src
JoJoJet 4b326fb4ca Improve safety for BlobVec::replace_unchecked (#7181)
# Objective

- The function `BlobVec::replace_unchecked` has informal use of safety comments.
- This function does strange things with `OwningPtr` in order to get around the borrow checker.

## Solution

- Put safety comments in front of each unsafe operation. Describe the specific invariants of each operation and how they apply here.
- Added a guard type `OnDrop`, which is used to simplify ownership transfer in case of a panic.

---

## Changelog

+ Added the guard type `bevy_utils::OnDrop`.
+ Added conversions from `Ptr`, `PtrMut`, and `OwningPtr` to `NonNull<u8>`.
2023-01-16 15:41:12 +00:00
..
default.rs default() shorthand (#4071) 2022-03-01 20:52:09 +00:00
float_ord.rs Document That FloatOrd Implements Hash and Eq Too (#5228) 2022-07-11 14:11:27 +00:00
futures.rs Document remaining members of bevy_utils (#6897) 2022-12-11 18:46:42 +00:00
label.rs Document remaining members of bevy_utils (#6897) 2022-12-11 18:46:42 +00:00
lib.rs Improve safety for BlobVec::replace_unchecked (#7181) 2023-01-16 15:41:12 +00:00
short_names.rs Move get_short_name utility method from bevy_reflect into bevy_utils (#5174) 2022-07-02 18:30:45 +00:00
synccell.rs Document remaining members of bevy_utils (#6897) 2022-12-11 18:46:42 +00:00