Module std::finallyDeprecated
[-] [+]
[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
fn main() { #![feature(unboxed_closures)] use std::finally::Finally; (|| { // ... }).finally(|| { // this code is always run }) }use std::finally::Finally; (|| { // ... }).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 |