clarify the docs of isolation (#17335)
* improve test coverage for isolation * a bit better * clarify the docs of isolation
This commit is contained in:
parent
3cbc80045d
commit
d8b5879c7d
1 changed files with 7 additions and 1 deletions
|
|
@ -29,15 +29,21 @@ proc `=destroy`*[T](dest: var Isolated[T]) {.inline.} =
|
|||
`=destroy`(dest.value)
|
||||
|
||||
func isolate*[T](value: sink T): Isolated[T] {.magic: "Isolate".} =
|
||||
## Create an isolated subgraph from the expression `value`.
|
||||
## Creates an isolated subgraph from the expression `value`.
|
||||
## Isolation is checked at compile time.
|
||||
##
|
||||
## 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`.
|
||||
##
|
||||
## .. warning:: The proc doesn't check whether `value` is isolated.
|
||||
##
|
||||
Isolated[T](value: value)
|
||||
|
||||
func extract*[T](src: var Isolated[T]): T =
|
||||
## Returns the internal value of `src`.
|
||||
## The value is moved from `src`.
|
||||
result = move(src.value)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue