mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-03-20 22:36:03 +02:00
Merge pull request #45 from Arthur-Milchior/patch-3
Makes ownership of `self` more accurate
This commit is contained in:
commit
1b59aa5d71
@ -8,7 +8,8 @@ are other possible receivers for a method:
|
||||
* `&mut self`: borrows the object from the caller using a unique and mutable
|
||||
reference. The object can be used again afterwards.
|
||||
* `self`: takes ownership of the object and moves it away from the caller. The
|
||||
method becomes the owner of the object and will drop (deallocate) it at the
|
||||
end of the scope.
|
||||
method becomes the owner of the object. The object will be drop (deallocated)
|
||||
when the method returns, unless it’s ownership is explicitly
|
||||
transmitted.
|
||||
* No receiver: this becomes a static method on the struct. Typically used to
|
||||
create constructors which are called `new` by convention.
|
||||
|
Loading…
x
Reference in New Issue
Block a user