mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 19:52:36 +00:00
Add unsafeIsolate and extract to std/isolation [backport:1.4] (#17263)
(cherry picked from commit 19be5eb1eb)
This commit is contained in:
@@ -44,5 +44,7 @@
|
||||
|
||||
|
||||
|
||||
- Added `unsafeIsolate` and `extract` to `std/isolation`.
|
||||
|
||||
## Tool changes
|
||||
|
||||
|
||||
@@ -30,3 +30,11 @@ func isolate*[T](value: sink T): Isolated[T] {.magic: "Isolate".} =
|
||||
## Please read https://github.com/nim-lang/RFCs/issues/244
|
||||
## for more details.
|
||||
Isolated[T](value: value)
|
||||
|
||||
func unsafeIsolate*[T](value: sink T): Isolated[T] =
|
||||
## Creates an isolated subgraph from the expression `value`.
|
||||
Isolated[T](value: value)
|
||||
|
||||
func extract*[T](src: var Isolated[T]): T =
|
||||
## Returns the internal value of `src`.
|
||||
result = move(src.value)
|
||||
|
||||
Reference in New Issue
Block a user