Allow unsized types as mapped value in Ref::map (#8817)
# Objective - I can't map unsized type using `Ref::map` (for example `dyn Reflect`) ## Solution - Allow unsized types (this is possible because `Ref` stores a reference to `T`)
This commit is contained in:
parent
527d3a5885
commit
ea887d8ffa
@ -551,7 +551,7 @@ impl<'a, T: ?Sized> Ref<'a, T> {
|
|||||||
///
|
///
|
||||||
/// This doesn't do anything else than call `f` on the wrapped value.
|
/// This doesn't do anything else than call `f` on the wrapped value.
|
||||||
/// This is equivalent to [`Mut::map_unchanged`].
|
/// This is equivalent to [`Mut::map_unchanged`].
|
||||||
pub fn map<U>(self, f: impl FnOnce(&T) -> &U) -> Ref<'a, U> {
|
pub fn map<U: ?Sized>(self, f: impl FnOnce(&T) -> &U) -> Ref<'a, U> {
|
||||||
Ref {
|
Ref {
|
||||||
value: f(self.value),
|
value: f(self.value),
|
||||||
ticks: self.ticks,
|
ticks: self.ticks,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user