feat(Functional): add compact Status, ErrorKind/ErrorCode, bounded chains, and Adapters (M-FUNCTIONAL-02)

This commit is contained in:
faumaray committed 2026-11-24 02:45:17 +03:00
1 parent 284d9635b5
commit 7f3395cb74
4 files changed
+556 -14

No files matched your search

+16
View File
@@ -37,6 +37,22 @@ namespace Void::Result
return Failure<Error>{Error{std::move(message)}};
}
/// Zero-allocation Failure factory from a compact Status.
[[nodiscard]] inline Failure<Error> fail(Status status) noexcept
{
return Failure<Error>{Error{status}};
}
/// Failure factory carrying explicit ErrorKind, message, and optional codes.
[[nodiscard]] inline Failure<Error> fail(ErrorKind kind,
std::string message,
ErrorCode code = {},
std::error_code sys = {})
{
return Failure<Error>{
Error{kind, std::move(message), code, sys}};
}
/// Convenience factory for a failed Result with an arbitrary E.
/// Constrained so string-like types resolve to the `std::string`
/// overload above (otherwise a literal `"..."` deduces E to a char