7#include <tl/expected.hpp>
25 return tl::unexpected<std::decay_t<E> >(std::forward<E>(value));
55using Unit = std::monostate;
64using Result = tl::expected<T, Error>;
67inline bool starts_with(std::string_view value, std::string_view prefix) {
68 return value.size() >= prefix.size() &&
69 value.substr(0, prefix.size()) == prefix;
74 return !value.empty() && value.front() == prefix;
78inline bool ends_with(std::string_view value, std::string_view suffix) {
79 return value.size() >= suffix.size() &&
80 value.substr(value.size() - suffix.size()) == suffix;
84inline bool ends_with(std::string_view value,
char suffix) {
85 return !value.empty() && value.back() == suffix;
bool starts_with(std::string_view value, std::string_view prefix)
Compatibility helper matching std::string_view::starts_with.
Definition result.hpp:67
std::monostate Unit
Success value for operations that only need to report failure.
Definition result.hpp:55
bool ends_with(std::string_view value, std::string_view suffix)
Compatibility helper matching std::string_view::ends_with.
Definition result.hpp:78
tl::expected< T, Error > Result
Alias for the SDK result type.
Definition result.hpp:64
constexpr auto unexpected(E &&value)
Creates an unexpected result value for the active expected backend.
Definition result.hpp:24
Structured error returned by fallible SDK operations.
Definition result.hpp:35
std::string detail
Optional extended diagnostic information.
Definition result.hpp:43
std::string category
Stable SDK error category such as "protocol", "transport", "handler", "timeout", or "cancellation".
Definition result.hpp:48
std::string message
Short human-readable explanation of the failure.
Definition result.hpp:40
int code
Numeric protocol, transport, or component-specific error code.
Definition result.hpp:37