Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Because
lst
is a slice ofu8
s and slices are non-owning by definition, callinglst.iter()
results in an iterator of references tou8
s (Iterator<Item = &u8>
).The return type of the
delete_nth
function isVec<u8>
, which can be built through.collect()
only from an iterator over owned values (Iterator<Item = u8>
).The iterator methods which allow such a conversion (from
Iterator<Item = &u8>
toIterator<Item = u8>
) are.cloned()
and.copied()
(either one works in this case).Awesome solution! Could someone help me understand why
.cloned()
is necessary here? Thanks!