Skip to content

Replace void-OK with dummy structs #8

@vorot93

Description

@vorot93

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:

Which begs a question: do we really need special casing for void? My proposal is:

  • Bar void from Ok
  • 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_CB for [&](const Dummy&)

This will lead to a closer-to-Rust Ok construction in the form of OK({}) and eliminate any void-related template issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions