It is recommended for API designers to require an implicitManager for the creation of custom resources, and to callacquire during those resources' construction. Doing so guarantees that the resourcemust be automatically managed, and makes it impossible to forget to do so. Example:
class SafeFileReader(file: File)(implicit manager: Using.Manager) extends BufferedReader(new FileReader(file)) { def this(fileName: String)(implicit manager: Using.Manager) = this(new File(fileName)) manager.acquire(this)}Registers the specified resource with this manager, so that the resource is released when the manager is closed.
Registers the specified resource with this manager, so that the resource is released when the manager is closed.
Registers the specified resource with this manager, so that the resource is released when the manager is closed, and then returns the (unmodified) resource.
Registers the specified resource with this manager, so that the resource is released when the manager is closed, and then returns the (unmodified) resource.