object Using extends Serializable
- Source
- Using.scala
- Alphabetic
- By Inheritance
- Using
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- trait ScopeExitHandler extends AutoCloseable
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def apply[R <: AutoCloseable](r: => R)(implicit dummyImplicit: DummyImplicit = DummyImplicit.dummyImplicit): Using[R]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- implicit def continuationUsingDsl[Domain, Value, R <: AutoCloseable](implicit tryFinally: TryFinally[Value, Domain, Domain, Domain], shiftDsl: Dsl[Shift[Domain, Value], Domain, Value]): Dsl[Using[R], !![Domain, Value], R]
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- implicit def implicitUsing[R <: AutoCloseable](r: => R): Using[R]
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- implicit def scalaFutureUsingDsl[R <: AutoCloseable, A](implicit executionContext: ExecutionContext): Dsl[Using[R], Future[A], R]
- def scopeExit(r: => ScopeExitHandler): Using[ScopeExitHandler]
Returns a Using keyword to execute a ScopeExitHandler when exiting the nearest enclosing scope that is annotated as @reset, (or the nearest enclosing function if compilerplugins.ResetEverywhere is enabled).
Returns a Using keyword to execute a ScopeExitHandler when exiting the nearest enclosing scope that is annotated as @reset, (or the nearest enclosing function if compilerplugins.ResetEverywhere is enabled).
The following function will perform
n *= 2
aftern += 20
:import scala.concurrent.Future import com.thoughtworks.dsl.keywords.Using.scopeExit var n = 1 def multiplicationAfterAddition = Future { !scopeExit { () => n *= 2 } n += 20 }
Therefore, the final value of
n
should be(1 + 20) * 2 = 42
.multiplicationAfterAddition.map { _ => n should be(42) }
- Note
This method is similar to apply, except the parameter type is changed from a generic
R
to the SAM type ScopeExitHandler, which allows for function literal expressions in Scala 2.12+ or Scala 2.11 with-Xexperimental
compiler option.
Example: - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])