Managing resources#
A file, socket, or response body closes when the binding that holds it goes out of scope, including on early returns and errors.
- Scope-end cleanup : when resources close, how to close early, and in what order
- Implementing
Closeable - Cleanup failures
Borrowing a resource does not extend its life: the owning binding closes it at scope end. See mutation and references .