Manager

object Manager
Companion
class
class Object
trait Matchable
class Any

Value members

Concrete methods

def apply[A](op: Manager => A): Try[A]

Performs an operation using a Manager, then closes the Manager, releasing its resources (in reverse order of acquisition).

Performs an operation using a Manager, then closes the Manager, releasing its resources (in reverse order of acquisition).

Example:

val lines = Using.Manager { use =>
 use(new BufferedReader(new FileReader("file.txt"))).lines()
}

If using resources which require an implicit Manager as a parameter, this method should be invoked with an implicit modifier before the function parameter:

Example:

val lines = Using.Manager { implicit use =>
 new SafeFileReader("file.txt").lines()
}

See the main doc for Using for full details of suppression behavior.

Type Params
A

the return type of the operation

Value Params
op

the operation to perform using the manager

Returns

a Try containing an exception if one or more were thrown, or the result of the operation if no exceptions were thrown