A type class describing how to release a particular type of resource.
A resource is anything which needs to be released, closed, or otherwise cleaned up in some way after it is finished being used, and for which waiting for the object's garbage collection to be cleaned up would be unacceptable. For example, an instance of java.io.OutputStream would be considered a resource, because it is important to close the stream after it is finished being used.
An instance of Releasable
is needed in order to automatically manage a resource
with Using
. An implicit instance is provided for all types extending
java.lang.AutoCloseable.
- Type parameters:
- R
the type of the resource
- Companion:
- object
- Source:
- Using.scala