Iterators in Rust
# Iterators
|
|
there are other iterators for other things like hash_maps
there are syntactic sugar forms for often used iterators.
|
|
how to empty collection without consuming collection itself
drain() method it takes different arguments depending on which collection it return iterator that takes ownership of some or all items in collection, removing the items from collection but leaving the collection intact.
|
|
takes a range
# ranges in loops
the syntax is two dots separating the beginning and end.
|
|
start is inclusive, end is exclusive.
if ..= is used the end will be inclusive
|
|
# IO
stdn -> program -> stdout
read and writing for programs