News for hackers. Stuff that matters.
Re:Rust Ownership Rules by Waterluvian on Monday March 02, 2020 @07:11AM (#22463711)
The function "consumes" the value. Its no longer valid in the function caller's scope.

Often the purpose is to consume the value and return a new kind of value. Maybe `validate_square` takes in `Shape` and returns `Option<Shape>`

If valid or invalid, we have consumed the shape so it cant be reused by accident and can't be used without handling the optional branches.

I'm new so maybe I'm off on this.

Re:Rust Ownership Rules by Cyph0n on Monday March 02, 2020 @08:40AM (#22464280)
In Rust, this is how “ownership” works. Once a variable is moved to a new scope, ownership moves with it, which means that it cannot be used in the current scope anymore.