11#ifndef MODDEF_ERROR_HPP
12#define MODDEF_ERROR_HPP
18#include "moddef/err.h"
51inline md_err_t
to_c(
Error e)
noexcept {
return static_cast<md_err_t
>(e); }
57using Result = std::expected<T, Error>;
62 if (e != MD_OK)
return std::unexpected(
from_c(e));
67 if (e != MD_OK)
return std::unexpected(
from_c(e));
Blocking register-level transport.
Definition transport.hpp:28
Definition command.hpp:35
Error
Strongly typed mirror of md_err_t (same underlying values, so casts are free in both directions).
Definition error.hpp:25
std::expected< T, Error > Result
The canonical result type across the API; Result<void> for actions.
Definition error.hpp:57
Result< void > check(md_err_t e)
Definition error.hpp:66
md_err_t to_c(Error e) noexcept
Definition error.hpp:51
Result< T > ok_or(md_err_t e, T value)
Definition error.hpp:61
std::string_view to_string(Error e) noexcept
Definition error.hpp:53
Error from_c(md_err_t e) noexcept
Definition error.hpp:50