Skip to content

Commit

Permalink
Add unsafeIsolate and extract to std/isolation [backport:1.4] (#17263)
Browse files Browse the repository at this point in the history
(cherry picked from commit 19be5eb)
  • Loading branch information
ringabout authored and narimiran committed Mar 18, 2021
1 parent e996d98 commit 6b00463
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@



- Added `unsafeIsolate` and `extract` to `std/isolation`.

## Tool changes

8 changes: 8 additions & 0 deletions lib/std/isolation.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 6b00463

Please sign in to comment.