mirror of
https://github.com/rust-unofficial/patterns
synced 2024-11-04 18:00:27 +00:00
RAII: stands for "Resource Acquisition is Initialisation"
Unfortunately, the name is even more terrible than initially was thought!
This commit is contained in:
parent
dc99e1eead
commit
a4a74e7d75
@ -2,7 +2,7 @@
|
||||
|
||||
## Description
|
||||
|
||||
RAII stands for "Resource allocation is initialisation" which is a terrible
|
||||
[RAII][wikipedia] stands for "Resource Acquisition is Initialisation" which is a terrible
|
||||
name. The essence of the pattern is that resource initialisation is done in the
|
||||
constructor of an object and finalisation in the destructor. This pattern is
|
||||
extended in Rust by using an RAII object as a guard of some resource and relying
|
||||
@ -109,7 +109,9 @@ works just as well.
|
||||
[Finalisation in destructors idiom](../idioms/dtor-finally.md)
|
||||
|
||||
RAII is a common pattern in C++: [cppreference.com](http://en.cppreference.com/w/cpp/language/raii),
|
||||
[wikipedia](https://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization).
|
||||
[wikipedia][wikipedia].
|
||||
|
||||
[wikipedia]: https://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization
|
||||
|
||||
[Style guide enty](http://doc.rust-lang.org/stable/style/ownership/raii.html)
|
||||
(currently just a placeholder).
|
||||
|
Loading…
Reference in New Issue
Block a user