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

Graydon Hoare graydon at mozilla.com
Wed Apr 11 10:21:27 PDT 2012


On 12-04-11 04:26 AM, Peter Ronnquist wrote:
> What does the minus sign mean when used as a prefix for the argument
> "input" in the function map_reduce()?

It's "move-in" mode. It works like '+' mode except that the caller is
oblige to relinquish its ownership; it's an error for the caller to
carry on using the argument after passing it, rather than an implicit
copy.

Modes are likely to change substantially as we finish up the
region-pointer system, hopefully during this development/release cycle.
There may not be any concept of distinct argument-modes when we're done,
we'll have to see.

For the time being I've added a brief description of '-' to the tutorial.

-Graydon


More information about the Rust-dev mailing list