Add downcast_ref to AnyViewHandle
I use unsafe code to transmute an AnyViewHandle to a ViewHandle<T> when the type matches. Because ViewHandle<T> is repr(transparent) to the wrapped AnyViewHandle, this is safe.
This commit is contained in:
@@ -2279,8 +2279,7 @@ mod tests {
|
||||
.map(|(ix, item)| {
|
||||
let mut state = item
|
||||
.as_any()
|
||||
.clone()
|
||||
.downcast::<TestItem>()
|
||||
.downcast_ref::<TestItem>()
|
||||
.unwrap()
|
||||
.read(cx)
|
||||
.label
|
||||
|
||||
Reference in New Issue
Block a user