I come from C++. In C++ we have std library and one of the "modules" in that library is "module" called algorithm which is basically a collection of different algorithms that can be used on virtually every collection from std library. Does something like this exists in rust or in rust this is achieved differently? And how if that's the case?
The algorithms are generally a bit more scattered around the standard library. Algorithms you can perform on any sequence of values are found on iterators. Algorithms you can perform on things with random access are provided on the slice types. Some collections have more algorithms on them, e.g.
BTreeSet has things like
Not really. I think lots of those algorithms exists in the
Iterator trait, (filter, map, fold, etc). Others (such as
sort) are implemented for slice, which makes them availiable on
(@alice wrote apprixmatley the same thing at approximatly the same time, ah well)
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.