You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This should work but doesn't for some lifetime reason.
// `IntoAbstract` would have to be implemented for the type `&'0 mut shipyard::ViewMut<'1, Component1>`, for any two lifetimes `'0` and `'1`...// ...but `IntoAbstract` is actually implemented for the type `&mut shipyard::ViewMut<'2, Component1>`, for some specific lifetime `'2` fnweird<T:Component + MutTrait>(mutv:ViewMut<T>)wherefor<'a,'b>&'a mutViewMut<'b,T>:IntoIter,for<'a,'b> <<&'a mutViewMut<'b,T>asIntoIter>::IntoIterasIterator>::Item:
std::ops::DerefMut<Target = T>,for<'a,'b> <&'a mutViewMut<'b,T>asIntoIter>::IntoIter:Iterator + LastId,{for(id,mut x)inWithId((&mut v).iter()){
x.mutmut();}}
And turns out the code in the issue you linked has the same issue. So I'm not sure it ever worked 😰
In theory something like this should also work:
fnweird<T:Component + MutTrait>(mutv:ViewMut<T>)wherefor<'a,'b>&'a mutViewMut<'b,T>:IntoIter,for<'a,'b> <<&'a mutViewMut<'b,T>asIntoIter>::IntoIterasIterator>::Item:
std::ops::DerefMut<Target = T>,// binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types// binding for associated type `Item` references lifetime `'b`, which does not appear in the trait input typesfor<'a,'b>WithId<<&'a mutViewMut<'b,T>asIntoIter>::IntoIter>:Iterator<Item = (EntityId,
<<&'a mutViewMut<'b,T>asIntoIter>::IntoIterasIterator>::Item,),>,{for(id,mut x)in(&mut v).iter().with_id(){
x.mutmut();}}
But it triggers this issue rust-lang/rust#49601.
And I think it would also trigger the other one.
So in conclusion I don't know how to write a generic ViewMut iterator, sorry.
#157 use some bounds to make generic ViewMut iterator work, but I still can not make generic ViewMut with_id work:
I try to add bounds but I still can not make it work.
Please help me, thanks!
The text was updated successfully, but these errors were encountered: