Merge branch 'devel' of github.com:nim-lang/Nim into devel
This commit is contained in:
commit
425f221440
19 changed files with 302 additions and 113 deletions
|
|
@ -324,12 +324,12 @@ proc mget*[T](future: FutureVar[T]): var T =
|
|||
## Future has not been finished.
|
||||
result = Future[T](future).value
|
||||
|
||||
proc finished*[T](future: Future[T] | FutureVar[T]): bool =
|
||||
proc finished*(future: FutureBase | FutureVar): bool =
|
||||
## Determines whether ``future`` has completed.
|
||||
##
|
||||
## ``True`` may indicate an error or a value. Use ``failed`` to distinguish.
|
||||
when future is FutureVar[T]:
|
||||
result = (Future[T](future)).finished
|
||||
when future is FutureVar:
|
||||
result = (FutureBase(future)).finished
|
||||
else:
|
||||
result = future.finished
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,12 @@ template createCb(retFutureSym, iteratorNameSym,
|
|||
try:
|
||||
if not nameIterVar.finished:
|
||||
var next = nameIterVar()
|
||||
# Continue while the yielded future is already finished.
|
||||
while (not next.isNil) and next.finished:
|
||||
next = nameIterVar()
|
||||
if nameIterVar.finished:
|
||||
break
|
||||
|
||||
if next == nil:
|
||||
if not retFutureSym.finished:
|
||||
let msg = "Async procedure ($1) yielded `nil`, are you await'ing a " &
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ proc isIpAddress*(address_str: string): bool {.tags: [].} =
|
|||
|
||||
when defineSsl:
|
||||
CRYPTO_malloc_init()
|
||||
SslLibraryInit()
|
||||
doAssert SslLibraryInit() == 1
|
||||
SslLoadErrorStrings()
|
||||
ErrLoadBioStrings()
|
||||
OpenSSL_add_all_algorithms()
|
||||
|
|
|
|||
|
|
@ -672,7 +672,10 @@ template walkCommon(pattern: string, filter) =
|
|||
if dotPos < 0 or idx >= ff.len or ff[idx] == '.' or
|
||||
pattern[dotPos+1] == '*':
|
||||
yield splitFile(pattern).dir / extractFilename(ff)
|
||||
if findNextFile(res, f) == 0'i32: break
|
||||
if findNextFile(res, f) == 0'i32:
|
||||
let errCode = getLastError()
|
||||
if errCode == ERROR_NO_MORE_FILES: break
|
||||
else: raiseOSError(errCode.OSErrorCode)
|
||||
else: # here we use glob
|
||||
var
|
||||
f: Glob
|
||||
|
|
@ -782,7 +785,10 @@ iterator walkDir*(dir: string; relative=false): tuple[kind: PathComponent, path:
|
|||
let xx = if relative: extractFilename(getFilename(f))
|
||||
else: dir / extractFilename(getFilename(f))
|
||||
yield (k, xx)
|
||||
if findNextFile(h, f) == 0'i32: break
|
||||
if findNextFile(h, f) == 0'i32:
|
||||
let errCode = getLastError()
|
||||
if errCode == ERROR_NO_MORE_FILES: break
|
||||
else: raiseOSError(errCode.OSErrorCode)
|
||||
else:
|
||||
var d = opendir(dir)
|
||||
if d != nil:
|
||||
|
|
|
|||
|
|
@ -129,8 +129,8 @@ type
|
|||
## The ``times`` module only supplies implementations for the systems local time and UTC.
|
||||
## The members ``zoneInfoFromUtc`` and ``zoneInfoFromTz`` should not be accessed directly
|
||||
## and are only exported so that ``Timezone`` can be implemented by other modules.
|
||||
zoneInfoFromUtc*: proc (time: Time): ZonedTime {.nimcall, tags: [], raises: [], benign .}
|
||||
zoneInfoFromTz*: proc (adjTime: Time): ZonedTime {.nimcall, tags: [], raises: [], benign .}
|
||||
zoneInfoFromUtc*: proc (time: Time): ZonedTime {.tags: [], raises: [], benign.}
|
||||
zoneInfoFromTz*: proc (adjTime: Time): ZonedTime {.tags: [], raises: [], benign.}
|
||||
name*: string ## The name of the timezone, f.ex 'Europe/Stockholm' or 'Etc/UTC'. Used for checking equality.
|
||||
## Se also: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
ZonedTime* = object ## Represents a zooned instant in time that is not associated with any calendar.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue