-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
Right now this library contains two versions of Result: one with normal Ok enum and another with void one.
It may be a short-term convenience for callers (simple Ok() suffices if there's nothing of value to return). However:
- Essentially there are two versions of each struct and function: double effort for maintenance
voidis an incomplete type and thus presents distant problems for callers (like TRY macro does not work with Result<void, E> #6)
Which begs a question: do we really need special casing for void? My proposal is:
- Bar
voidfromOk - Provide a dummy type alias for empty tuple (
std::tuple<>) / empty struct (struct {}) and relevant Ok (using OK = Ok<Dummy>) - Include special macro for convenient lambda creation (e.g.
DUMMY_CBfor[&](const Dummy&)
This will lead to a closer-to-Rust Ok construction in the form of OK({}) and eliminate any void-related template issues.
wintercherry and victor-mlai
Metadata
Metadata
Assignees
Labels
No labels