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
commit 19be5eb1eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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. - `--newruntime` and `--refchecks` are deprecated.
- Added `unsafeIsolate` and `extract` to `std/isolation`.
## Tool changes ## Tool changes
- The rst parser now supports markdown table syntax. - 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 ## Please read https://github.com/nim-lang/RFCs/issues/244
## for more details. ## for more details.
Isolated[T](value: value) 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)