Resource

trait Resource[A] extends AutoCloseable

Resource that can be closed.

Companion:
object
trait AutoCloseable
class Object
trait Matchable
class Any

Value members

Abstract methods

def close(): Unit
def get: A

Concrete methods

def use[U](body: A => U): U

Use the resource within the limited scope. After existing the scope, the resource will be closed

Use the resource within the limited scope. After existing the scope, the resource will be closed

def wrapFuture[U](body: A => Future[U])(implicit ec: ExecutionContext): Future[U]

Wrap a Future with this resource. After the future completes, the resource will be closed

Wrap a Future with this resource. After the future completes, the resource will be closed