Re:A half-hour to learn Rust
by millstone on Saturday January 02, 2021 @05:52PM
(#25617399)
The operator overloading is nice but you still get smacked in the face right away by the borrow checker. Simple stuff like this won't compile ("use of moved value"):
[ Parent
| on HN ]
This would work if `Integer` would implement the `Copy` trait. But I guess that type is heavy enough for it to be too expensive, therefore forcing you to explicitly call `clone()`.
That `Integer` type can't implement `Copy` because it manages a resource, meaning you can't just do a simple memcpy of the type.