Open
Description
There's been discussion on the tracking issue:
...about which methods to add to the new Range
types. Let's continue that here.
To see which iterator methods we may want to add to the new ranges, I did an informal search on Github using the following query:
language:rust NOT is:fork /\W\s*\(\s*\w*\s*\.\.=?\s*\w*\s*\)\s*.\s*method\s*\(/
I matched on anything that looks like
( <> .. <> )
or( <> ..= <> )
that is not immediately preceded by some identifier character, to avoid matching things likevec.drain(..).map(_)
.Example for
map
: search.This isn't perfect but captures a rough amount of usage. Just looking by the number of matches:
map
: 65.8krev
: 23.2kcollect
: 9.9kfor_each
: 8.5kstep_by
: 8.3kfilter
: 8.2kflat_map
: 4.2kfold
: 3.5kzip
: 3.4kfilter_map
: 1.6kfind
: 1.5kchain
: 1.4ktake_while
: 1.1kall
: 1.1kcycle
: 0.7kenumerate
: 0.6kscan
: 0.4kproduct
: 0.4kfind_map
: 0.3kany
: 0.3ksum
: 0.2ktake
: 0.2kskip
: 0.1ktry_*
: 0.1kmin*
: 0.1kmax*
: 0.1kmap_while
: 0.1kposition
: 0.1kskip_while
: 0.1kcount
: 0.1kreduce
: 0.1knth
: 0.1kunzip
: 0I personally think
filter
is a decent cut-off, which gives the inherent methodsmap
,rev
,collect
,for_each
,step_by
,filter
.