* Added `IntervalSet`, sets of non-adjacent intervals
Relocated from nimbus-eth1 snap sync development
* Fix local import directive
* Fix --styleCheck complaints
* Attempt to get around CI problem by varying items
details:
Vary all_tests exec list
Hide useless globalness of `noisy` constant in non-debugging mode
* Re-route KeyError exceptions as Defect for all except the `[]` function
why:
Access via key is verified, error is returned via Result[]
* Refactor lruFetch() item rotation
why:
Previously, the item was deleted and re-inserted in the table although
for rotation, only the queue links need to be updated.
* Delete some KeyError annotations
why:
Was overlooked earlier
* More KeyError fixes
* `Result` refresh
* add full support for `Result[T, void]` (aka `Opt[T]` aka `Option[T]`)
* expand tests
* add `flatten`, `filter` of `Option` fame
* add `tryError` that raises a regular exception when result holds a
value
* fix `$` to print `ok`/`err` in lower-case, like the functions that
created the result
* add `orErr` that collapses all errors to a single value of a
potentially different type - useful when translating errors between
layers
* `capture` should work with `CatchableError`
* remove `Defect`-dependent tests
* Update stew/results.nim
* avoid redundant error message when converting error to string
* avoid multiple evaluation in `valueOr`
* add `unsafeError` to match `unsafeGet`
* let `valueOr` evaluate a block
* add `errorOr` to mirror `valueOr`
Looking at generated assembly, it turns out the optimizer is not smart
enough to get rid of the loop - use `copyMem` instead.
At least the compiler is smart enough to constant-propagate runtime
endian direction, resolving the review comment.
Also clarify why a minimum length is enfored - it could perhaps be
revisited, but that would leave a slightly odd API.
the `array` overloads are actually unnecessary with an optimizing
compiler - as long as it can prove the length, any extra checks will go
away on their own
also add `initCopyFrom`
* document optimizations
* Optimized and exception-less encoding/decoding procedures for decimal integers.
* Add tests.
* Fix import path.
* Fix review comments.
* Code simplification.
* Make toBytes() allocation free.
* Do not perform conversion to signed type to avoid compiler's overflow checks.
Leb128 is a variable-length encoding for unsigned integers that is used
in a number of contexts - in particular, wasm, dwarf and protobuf.
This is an optimized low-level implementation that unrolls the loop
reading/writing the buffer - it is suitable to use as base for a more
specific API - no memory allocations, no exceptions.
This PR also fixes bitops2 to not raise on certaing uint->int
conversions, adapting bitops to nim 1.0 conversion rules by using a cast
instead of raising on uint->int conversion
* random helpers
* arrayops as a home for small array/openArray utilities
* assign2 - a replacement for genericAssign and assignment operators in
general which in nim are very slow
* use assign2 in a few places to speed things up
* fixes
* fixes
* Initial commit of UserOnly Windows ACL settings for files and folders.
* Move ACL procedures to windows/acl.
Move ACL tests to test_winacl.nim.
* Add test_winacl.nim
* Fix *nix compilation problem.
* More proper fix for *nix targets.
* Initial commit of io2 module
* Rename to io2.
Add createPath with permissions.
Add writeFile with permissions.
Add tests.
* Add test_io2 to all tests.
* Add posix permissions.
* Add toString procedure for set[Permission] and tests.
* Remove safeio.nim
* Add setPermissions procedures.
Fix writeFile() to change permissions.
Add more writeFile() tests.
* Change C ReadOnly/WriteOnly/ReadWrite to pair of Read/Write.
Add tests for openFile.
* File handles is no inherited by default, with option to turn on inheritance.
* Review comments fixes.
More tests.
* Fix x86 compilation problems.
* Rename toSet -> toPermissions.
* Avoid race condition on writeFile permissions.
This code is extracted from the error-handling proposal where it's
used to implement `Try` blocks (Faux closures are created there in
order to assign raises lists to them). The desktop team faced a
similar problem where the `spawn` API doesn't support closures,
but the restriction can be easily worked-around with faux closures.