Module std::finallyExperimental
[-]
[+]
[src]
The Finally trait provides a method, finally on
stack closures that emulates Java-style try/finally blocks.
Using the finally method is sometimes convenient, but the type rules
prohibit any shared, mutable state between the "try" case and the
"finally" case. For advanced cases, the try_finally function can
also be used. See that function for more details.
Example
#![feature(unboxed_closures)] use std::finally::Finally; fn main() { (|&mut:| { // ... }).finally(|| { // this code is always run }) }use std::finally::Finally; (|&mut:| { // ... }).finally(|| { // this code is always run })
Traits
| Finally | A trait for executing a destructor unconditionally after a block of code, regardless of whether the blocked fails. |
Functions
| try_finally | The most general form of the |