Function rust_examples::collect::read_files [−][src]
Expand description
Traversing a Result works analogously to an Option since a result is basically an option
where the None case is some more specific type.
Other languages typically implement a general .traverse(f) method, so it might seem that
collect is not as expressive (it’s equivalent to .sequence). However, .traverse(f) is
equivalent to .map(f).sequence. See the reference to Typelevel Cats for more.
Note that std::io::Result is just ordinary result with io error Result<T, std::io::Error>.
