Commit c5f4546
## Objective
Closes bevyengine#21349
Provides an ergonomic way to create a `Handle<A>` from a `Uuid` at
runtime.
## Solution
Implements the `From<Uuid>` trait for `Handle<A>`, allowing users to
write:
```rust
let uuid = Uuid::new_v4();
let handle: Handle<Image> = uuid.into();
```
Instead of the current verbose approach:
```rust
let handle = Handle::<Image>::Uuid(uuid, PhantomData);
```
## Testing
- Added comprehensive test `from_uuid` that verifies:
- Conversion from `Uuid` to `Handle<A>` works correctly
- The resulting handle is a UUID variant
- The handle ID matches the input UUID
- Both `.into()` and explicit `From::from()` work
- All existing handle tests continue to pass
- Clippy and formatting checks pass
---------
Co-authored-by: Alice Cecile <[email protected]>
Co-authored-by: François Mockers <[email protected]>
1 parent 7a4b80b commit c5f4546
1 file changed
+16
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
271 | 278 | | |
272 | 279 | | |
273 | 280 | | |
| |||
626 | 633 | | |
627 | 634 | | |
628 | 635 | | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
629 | 645 | | |
630 | 646 | | |
631 | 647 | | |
| |||
0 commit comments