7 ms·
That's actually even way too much code for the Rust version. A wrapper type declaration is as simple as `struct MoveOnlyInt(i32);`, and construction is then jus
by kibwen 10y ago
That's actually even way too much code for the Rust version. A wrapper type declaration is as simple as `struct MoveOnlyInt(i32);`, and construction is then just `let foo = MoveOnlyInt(42);`. (And of course, the wrapper type is only necessary because integers in Rust implement `Copy`, opting out of move semantics.)
- steveklabnik 10y ago(and "operator int" would be foo.0 in this case)
- mrout 10y agoIt's actually far too little code, as it leaves out all the code in the Rust compiler that implements this.