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 class
objectManager

Attributes

Companion
class
Source
Using.scala
Graph
Supertypes
classObject
traitMatchable
classAny
Self type
Manager.type

Members list

Value members

Concrete methods

defapply[A](op:Manager=>A):Try[A]

Performs an operation using aManager, then closes theManager, releasing its resources (in reverse order of acquisition).

Performs an operation using aManager, then closes theManager, 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 implicitManager as a parameter, this method should be invoked with animplicit modifier before the function parameter:

Example:

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

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

Type parameters

A

the return type of the operation

Value parameters

op

the operation to perform using the manager

Attributes

Returns

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

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