co_usb
Loading...
Searching...
No Matches
co_usb::detail::ErrorProtocol Concept Reference

Result protocol for signaling error via error code or full completion. More...

#include <error_protocol.hpp>

Concept definition

template<typename Ty, typename ValTy>
concept co_usb::detail::ErrorProtocol = requires(Ty errp) {
typename Ty::template return_type<ValTy>;
{
errp.template with_error<ValTy>(std::declval<std::error_code>())
} -> std::same_as<typename Ty::template return_type<ValTy>>;
{
errp.template with_success<ValTy>(std::declval<ValTy>())
} -> std::same_as<typename Ty::template return_type<ValTy>>;
}
Result protocol for signaling error via error code or full completion.
Definition error_protocol.hpp:39

Detailed Description

Result protocol for signaling error via error code or full completion.

Template Parameters
Tytype of an error protocol
ValTytype of result value

Uniform protocol that allows the compile-time selection of an error protocol for a wrapper function when a partial result is disallowed.

Guarantees
Error protocol is expected to be transient and be move constructible and assignable. Its destructor is expected to not invoke any meaningful logic.

with_success signals complete success and returns a successful result value. with_error signals error and returns an erronous result value.