Add Option<Res>::cloned
#8749
Labels
A-ECS
Entities, components, systems, and events
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
What problem does this solve or what need does it fill?
Res
does not implementClone
, but instead has a customclone
method. This does not play well when using anOption<Res>
that you need to clone sinceOption::cloned
requires the inner type to implementClone
.What solution would you like?
It would be nice to have an extension to
Option<Res>
that creates a customcloned
method that calls the customRes::clone
method. Then I could do something like this:What alternative(s) have you considered?
Right now my code looks like this:
IMO it's pretty messy. It's possible there's a simpler workaround already existing. I am new to Rust, so this is the best I've got.
Additional context
I think I know just enough Rust to be able to contribute this if y'all think it's worth it. Also this change doesn't appear to be breaking, so that's nice.
The text was updated successfully, but these errors were encountered: