[rust-dev] '-' as prefix to a function argument?

Peter Ronnquist peter.ronnquist at gmail.com
Wed Apr 11 04:26:13 PDT 2012


I have a question regarding '-' as a prefix to a function argument as
used in the task-perf-word-count.rs test file:


fn map_reduce(-inputs: [str]) { ....

fn main(argv: [str]) {
    let inputs = if vec::len(argv) < 2u {
        [input1(), input2(), input3()]
    } else {
        vec::map(vec::slice(argv, 1u, vec::len(argv)),
                 {|f| result::get(io::read_whole_file_str(f)) })

    let start = time::precise_time_ns();


What does the minus sign mean when used as a prefix for the argument
"input" in the function map_reduce()?

I looked for this in the tutorial and the reference manual but I could
only find reference to '+' in the 7.4 "Argument passing styles" :
"Then there is the by-copy style, written +."

Peter Ronnquist

More information about the Rust-dev mailing list