Repository navigation
fix: harden Result state representation - #22
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 13548c29e8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Result(U&& value) | ||
| : storage_(std::in_place_index<0>, std::forward<U>(value)) {} |
There was a problem hiding this comment.
Preserve braced success construction
When a success payload is supplied as a braced initializer, such as Result<std::vector<int>>{{1, 2, 3}} or return {{1, 2, 3}}, template argument deduction cannot infer U, so code accepted by the previous Result(T) constructor now fails to compile. Preserve a non-template path for constructing T from a braced initializer while retaining the special handling required for Result<Error>.
Useful? React with 👍 / 👎.
Summary
Starts roadmap milestone v0.8 by hardening the project-owned
Result<T>contract without replacing the currentstd::variantstorage baseline.Result changes
std::get_ifso wrong-state access does not hide astd::bad_variant_accesspath insidenoexceptResult<T>::success(...)andResult<T>::failure(...)factoriesResult<Error>capable of representing both success and failure unambiguouslyResult<Error>{Error{...}}remains the failure form; successfulErrorpayloads useResult<Error>::success(...)Result<void>until a concrete specialization is requiredstd::variantrather than adding custom manual storage before measurement justifies itTests
Adds dedicated
Result<T>coverage for:Result<Error>success/failure distinctionDocumentation
Result<T>contract with explicit factory semantics and theResult<Error>ruledocs/roadmap.md: v0.5, v0.6 and v0.7 are complete; v0.8 is now in progressScope
This PR does not change HTTP, transport, redirect, or connection-reuse behavior. It is the first focused correctness-hardening PR for v0.8.