withResource()
needs an implicit evidence parameter of this type
to know how to release what's passed to it.
withResource()
needs an implicit evidence parameter of this type
to know how to release what's passed to it.
the type (which must be contravariant to allow, for instance,
a T
of Closeable
to apply to subclasses like InputStream
).
Companion object for CanReleaseResource
, providing predefined implicit
evidence parameters for withResource()
.
Enrichment classes, generally for things in scala.util
.
Ensure that a closeable object is closed.
Ensure that a closeable object is closed. Note that this function
requires an implicit evidence parameter of type CanClose
to determine
how to close the object. You can implement your own, though common
ones are provided automatically.
Sample use:
withResource(new java.io.FileInputStream("/path/to/file")) { in => ... }
the object that holds a resource to be released
the code block to execute with the resource
the resource manager that can release the resource
whatever the block returns
Miscellaneous utility functions and methods not otherwise categorized.