Add unsafeIsolate and extract to std/isolation [backport:1.4] (#17263)

This commit is contained in:
flywind
2021-03-05 23:21:33 +08:00
committed by GitHub
parent b2b23d723a
commit 19be5eb1eb
2 changed files with 10 additions and 0 deletions

View File

@@ -252,6 +252,8 @@ provided by the operating system.
- `--newruntime` and `--refchecks` are deprecated.
- Added `unsafeIsolate` and `extract` to `std/isolation`.
## Tool changes
- The rst parser now supports markdown table syntax.

View File

@@ -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)