Open hellow554 opened 6 years ago
Currently When I want something like
fn foo(a: &mut Vec<u8>) -> impl Iterator<Item=u8> { Heap::new(&mut a).map(|h| 0) }
it won't work, because it says, that a won't live long enough, so I have to do it like
a
fn foo(a: &mut Vec<u8>) -> impl Iterator<Item=u8> { let heap = Heap::new(&mut a).collect::<Vec<_>>(); heap.into_iter().map(|h| 0) }
which is ... meh. Either accepting a slice and hold an internal mutable buffer, or taking a slice as value and store it inside, but this &mut causes some trouble.
&mut
Currently When I want something like
it won't work, because it says, that
a
won't live long enough, so I have to do it likewhich is ... meh. Either accepting a slice and hold an internal mutable buffer, or taking a slice as value and store it inside, but this
&mut
causes some trouble.