bevy/crates/bevy_reflect/src
andriyDev 04d5685889
Make drain take a mutable borrow instead of Box<Self> for reflected Map, List, and Set. (#15406)
# Objective

Fixes #15185.

# Solution

Change `drain` to take a `&mut self` for most reflected types.

Some notable exceptions to this change are `Array` and `Tuple`. These
types don't make sense with `drain` taking a mutable borrow since they
can't get "smaller". Also `BTreeMap` doesn't have a `drain` function, so
we have to pop elements off one at a time.

## Testing

- The existing tests are sufficient.

---

## Migration Guide

- `reflect::Map`, `reflect::List`, and `reflect::Set` all now take a
`&mut self` instead of a `Box<Self>`. Callers of these traits should add
`&mut` before their boxes, and implementers of these traits should
update to match.
2024-09-30 17:19:13 +00:00
..
enums Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
func Remove Return::Unit variant (#15484) 2024-09-28 16:26:55 +00:00
impls Make drain take a mutable borrow instead of Box<Self> for reflected Map, List, and Set. (#15406) 2024-09-30 17:19:13 +00:00
path Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
serde Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
array.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
attributes.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
fields.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
from_reflect.rs bevy_reflect: Update on_unimplemented attributes (#15110) 2024-09-09 16:26:17 +00:00
kind.rs Fix ReflectKind description wording (#15498) 2024-09-28 16:26:00 +00:00
lib.rs Make drain take a mutable borrow instead of Box<Self> for reflected Map, List, and Set. (#15406) 2024-09-30 17:19:13 +00:00
list.rs Make drain take a mutable borrow instead of Box<Self> for reflected Map, List, and Set. (#15406) 2024-09-30 17:19:13 +00:00
map.rs Make drain take a mutable borrow instead of Box<Self> for reflected Map, List, and Set. (#15406) 2024-09-30 17:19:13 +00:00
reflect.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
reflectable.rs bevy_reflect: Add Reflectable trait (#5772) 2024-09-18 00:36:41 +00:00
remote.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
set.rs Make drain take a mutable borrow instead of Box<Self> for reflected Map, List, and Set. (#15406) 2024-09-30 17:19:13 +00:00
std_traits.rs
struct_trait.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
tuple_struct.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
tuple.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
type_info_stack.rs Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00
type_info.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
type_path.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
type_registry.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
utility.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00