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
Apologies if any terms aren't right, I'm still learning rust.
Currently, if you want to return an iterator consuming a temporary variable, you can't, because IntoIter is only implemented for &T and &mut T.
// Works, because arrays implement IntoIter returning f32for x in(|| [0.0f32,1.0f32].into_iter())(){print!("{}\n", x);}// Does not work, because nalgebra::Vector2 does not implement IntoIter returning f32, so the compiler picks &f32 insteadfor x in(|| Vector2::new(0.0f32,1.0f32).into_iter())(){print!("{}\n", x);}
Apologies if any terms aren't right, I'm still learning rust.
Currently, if you want to return an iterator consuming a temporary variable, you can't, because
IntoIter
is only implemented for&T
and&mut T
.https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=e3c5472e96dbe560be70cf3c5e55c6b8
I was wondering if would possible to add the missing to implementation to support this? Is there some potential technical limitation I can't see?
Note that it's currently possible to work around this problem for very simple situations by chaining iterators over copies of each field.
The text was updated successfully, but these errors were encountered: