Movatterモバイル変換


[0]ホーム

URL:


Scala 3
3.7.4
LearnInstallPlaygroundFind A LibraryCommunityBlog
Scala 3
LearnInstallPlaygroundFind A LibraryCommunityBlog
DocsAPI
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL
Scala 3/scala/scala.util/Using/Manager

Manager

scala.util.Using.Manager
See theManager companion object
finalclassManager

A resource manager.

Resources can be registered with the manager by callingacquire; such resources will be released in reverse order of their acquisition when the manager is closed, regardless of any exceptions thrown during use.

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

Attributes

Note

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)}
Companion
object
Source
Using.scala
Graph
Supertypes
classObject
traitMatchable
classAny

Members list

Value members

Concrete methods

defacquire[R :Releasable](resource:R):Unit

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.

Attributes

Source
Using.scala
defapply[R :Releasable](resource:R): resource.type

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.

Attributes

Source
Using.scala
In this article
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL

[8]ページ先頭

©2009-2025 Movatter.jp