various small documentation improvements (#18602)

This commit is contained in:
Miran 2021-07-28 14:31:13 +02:00 • committed by GitHub
commit e616675c41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 123 additions and 97 deletions

View file

@ -10,8 +10,9 @@
## An implementation of a `deque`:idx: (double-ended queue).
## The underlying implementation uses a `seq`.
##
## Note that none of the procs that get an individual value from the deque should be used
## on an empty deque.
## .. note:: None of the procs that get an individual value from the deque should be used
## on an empty deque.
##
## If compiled with the `boundChecks` option, those procs will raise an `IndexDefect`
## on such access. This should not be relied upon, as `-d:danger` or `--checks:off` will
## disable those checks and then the procs may return garbage or crash the program.
@ -198,7 +199,7 @@ iterator items*[T](deq: Deque[T]): lent T =
## Yields every element of `deq`.
##
## **See also:**
## * `mitems iterator <#mitems,Deque[T]>`_
## * `mitems iterator <#mitems.i,Deque[T]>`_
runnableExamples:
from std/sequtils import toSeq
@ -214,7 +215,7 @@ iterator mitems*[T](deq: var Deque[T]): var T =
## Yields every element of `deq`, which can be modified.
##
## **See also:**
## * `items iterator <#items,Deque[T]>`_
## * `items iterator <#items.i,Deque[T]>`_
runnableExamples:
var a = [10, 20, 30, 40, 50].toDeque
assert $a == "[10, 20, 30, 40, 50]"
@ -274,7 +275,7 @@ proc addFirst*[T](deq: var Deque[T], item: sink T) =
## Adds an `item` to the beginning of `deq`.
##
## **See also:**
## * `addLast proc <#addLast,Deque[T],T>`_
## * `addLast proc <#addLast,Deque[T],sinkT>`_
runnableExamples:
var a = initDeque[int]()
for i in 1 .. 5:
@ -290,7 +291,7 @@ proc addLast*[T](deq: var Deque[T], item: sink T) =
## Adds an `item` to the end of `deq`.
##
## **See also:**
## * `addFirst proc <#addFirst,Deque[T],T>`_
## * `addFirst proc <#addFirst,Deque[T],sinkT>`_
runnableExamples:
var a = initDeque[int]()
for i in 1 .. 5: