diff options
-rw-r--r-- | src/library/scala/annotation/unique/package.scala | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/library/scala/annotation/unique/package.scala b/src/library/scala/annotation/unique/package.scala index 7fc4101b7e..1cb652a084 100644 --- a/src/library/scala/annotation/unique/package.scala +++ b/src/library/scala/annotation/unique/package.scala @@ -26,6 +26,16 @@ package object unique { def captured: A = x } + /* Swaps an object stored in a unique field with another unique object. + * + * The unique object that is the new value of the unique field becomes + * unusable by the caller. + * + * @param to the unique field that is the target of the swap + * @param from the unique object that is moved into the unique field + * @return the unique object that was the value of the unique + * field before the swap + */ def swap[A, B <: A](to: A, from: B): A = to } |