Releases: Hackerl/zero
Releases · Hackerl/zero
v1.2.0
Breaking Changes
async: Revamped Future/Promise API
- Introduced
Executorinterface andInlineExecutorsingleton; callbacks are now dispatched through the bound executor instead of being called inline. - Introduced
SemiFuture<T, E>: a future without a bound executor.Promise::getFuture()now returnsSemiFuture; callers must call.via(executor)to obtain aFuture. chain()renamed tocontract(); it now accepts anExecutorand returnsContract<T, E>(std::pair<Promise, Future>). The executor propagates through the entire callback chain.- Added
Future::resolved(),Future::rejected(),SemiFuture::resolved(),SemiFuture::rejected()static factory methods for constructing immediately-ready futures.
meta: Namespace and header reorganization
- Renamed namespace
zero::traits→zero::meta; headers moved frominclude/zero/traits/toinclude/zero/meta/. - Split into separate
meta/type_traits.handmeta/concepts.hheaders. - Type traits now use PascalCase with an
Isprefix forboolvariable templates (e.g.,is_specialization_v→IsSpecialization). - Removed
applicabletraits; userequiresexpressions directly instead. - Removed
zero::Interfacebase class; virtual destructors are now defined explicitly per class.
filesystem / strings: Flattened header paths
include/zero/filesystem/fs.h→include/zero/filesystem.hinclude/zero/strings/strings.h→include/zero/strings.h- Directory iteration: replaced the iterator-emulating
NoExcepttype with a pull-basednext()API returningstd::expected<std::optional<DirectoryEntry>>, making error propagation explicit.
Infallible APIs now throw instead of returning std::expected
- The following APIs now throw on failure instead of returning a typed error code:
zero::os::process::self(),zero::os::process::all(),zero::os::net::interfaces(),zero::os::stat::cpu(),zero::os::stat::memory(),zero::os::hostname(),zero::os::pipe(),Resource::isInheritable(),Resource::duplicate(),Resource::setInheritable(),zero::filesystem::temporaryDirectory(),zero::filesystem::absolute(),zero::filesystem::currentPath(), and several internal procfs / PEB parsing helpers. cmdline:scan()andparseValue()now throw instead of returningstd::expected.log:IProviderinterface methods now throw instead of returningstd::expected.
promise
- Empty-range handling now throws instead of triggering an assertion.
- When aggregating futures whose result type is
void, the placeholder in the result tuple changed fromstd::nullptr_ttostd::monostate.
New Features
- promise: Promise chains now support exception handling —
.then/.fail/.finallycallbacks may throw; exceptions are captured and propagated through the chain. (1368a85) - error: New
zero::error::capture(f)helper that invokes a callable and converts any thrown exception intostd::unexpected, bridging exception-based andstd::expected-based code. (0cfe644) - filesystem:
readDirectoryandwalkDirectorynow have overloads accepting aDirectoryOptionsargument. (e0e5b7b)
Bug Fixes
- Windows / net: Several WinSock APIs return error codes directly rather than setting the value retrieved by
GetLastError(); error retrieval is now correct for these APIs. (abd892a) - Windows / process:
TerminateProcessmay returnERROR_ACCESS_DENIEDwhen the target process has already exited; this is now treated as a success. (f01dbf9) - macOS / process:
sysctl(KERN_PROCARGS2)does not report an error when the buffer is too small; the call is now issued twice — once to obtain the required size, once to fetch the data. If the target process callsexec()between the two calls, the new program's argument area may exceed the estimated size; the fetch is now retried with a larger buffer when this is detected. (e29f63b, 4bb83e0) - macOS / process:
Process::envs()no longer throws when theKERN_PROCARGS2buffer ends immediately after the last environment variable's null terminator; buffer exhaustion is now treated as a valid termination condition. (844bc86) - meta:
FunctionTraitsreference specializations now strip cv-qualifiers before deducing the function type, fixing incorrect trait results forconst/volatilereferences. (5a78c7b)
Build
- CMake minimum required version updated; platform detection logic simplified. (fa59675)