Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a remove method to the Map reflection trait #6563

Closed
soqb opened this issue Nov 12, 2022 · 0 comments
Closed

Add a remove method to the Map reflection trait #6563

soqb opened this issue Nov 12, 2022 · 0 comments
Labels
A-Reflection Runtime information about types C-Feature A new feature, making something new possible

Comments

@soqb
Copy link
Contributor

soqb commented Nov 12, 2022

What problem does this solve or what need does it fill?

There is currently no way to remove an entry from a dyn Map other than through downcasting.

What solution would you like?

Add a remove method to the Map trait which takes in an &dyn Reflect key and returns an Option<Box<dyn Reflect>> representing the value removed (if present).

What alternative(s) have you considered?

Leave as is, require downcasting to remove entries.

Additional context

As discussed with @MrGVSV on discord. Compliments the work done in #5797 (List::pop).

@soqb soqb added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Nov 12, 2022
@MrGVSV MrGVSV added A-Reflection Runtime information about types and removed S-Needs-Triage This issue needs to be labelled labels Nov 12, 2022
@MrGVSV MrGVSV moved this to Open in Reflection Nov 12, 2022
@MrGVSV MrGVSV moved this from Open to In Progress in Reflection Nov 12, 2022
@bors bors bot closed this as completed in 9498bff Nov 14, 2022
Repository owner moved this from In Progress to Done in Reflection Nov 14, 2022
taiyoungjang pushed a commit to taiyoungjang/bevy that referenced this issue Dec 15, 2022
# Objective

- Implements removal of entries from a `dyn Map`
- Fixes bevyengine#6563

## Solution

- Adds a `remove` method to the `Map` trait which takes in a `&dyn Reflect` key and returns the value removed if it was present.

---

## Changelog

- Added `Map::remove`

## Migration Guide

- Implementors of `Map` will need to implement the `remove` method.


Co-authored-by: radiish <thesethskigamer@gmail.com>
alradish pushed a commit to alradish/bevy that referenced this issue Jan 22, 2023
# Objective

- Implements removal of entries from a `dyn Map`
- Fixes bevyengine#6563

## Solution

- Adds a `remove` method to the `Map` trait which takes in a `&dyn Reflect` key and returns the value removed if it was present.

---

## Changelog

- Added `Map::remove`

## Migration Guide

- Implementors of `Map` will need to implement the `remove` method.


Co-authored-by: radiish <thesethskigamer@gmail.com>
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
# Objective

- Implements removal of entries from a `dyn Map`
- Fixes bevyengine#6563

## Solution

- Adds a `remove` method to the `Map` trait which takes in a `&dyn Reflect` key and returns the value removed if it was present.

---

## Changelog

- Added `Map::remove`

## Migration Guide

- Implementors of `Map` will need to implement the `remove` method.


Co-authored-by: radiish <thesethskigamer@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Reflection Runtime information about types C-Feature A new feature, making something new possible
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants