|
| | Result (T &&value) noexcept |
| | Construct a successful result with value.
|
| |
| | Result (const T &value) noexcept |
| | Construct a successful result with value (copy)
|
| |
| | Result (ErrorCode error) noexcept |
| | Construct an error result.
|
| |
| | operator bool () const noexcept |
| | Check if result is OK (bool operator for cleaner syntax)
|
| |
| bool | IsOk () const noexcept |
| | Check if result is OK.
|
| |
| bool | IsErr () const noexcept |
| | Check if result is an error.
|
| |
| ErrorCode | Error () const noexcept |
| | Get the error code.
|
| |
| const char * | ErrorMessage () const noexcept |
| | Get human-readable error message.
|
| |
| T & | Value () noexcept |
| | Get the result value (mutable reference)
|
| |
| const T & | Value () const noexcept |
| | Get the result value (const reference)
|
| |
| T | ValueOr (const T &default_value) const noexcept |
| | Get the result value or a default.
|
| |
| template<std::size_t N> |
| std::enable_if_t< N==0, ErrorCode > | get () const &noexcept |
| | Support structured bindings: auto [err, value] = result;.
|
| |
| template<std::size_t N> |
| std::enable_if_t< N==1, const T & > | get () const &noexcept |
| |
| template<std::size_t N> |
| std::enable_if_t< N==0, ErrorCode > | get () &noexcept |
| |
| template<std::size_t N> |
| std::enable_if_t< N==1, T & > | get () &noexcept |
| |
| template<std::size_t N> |
| std::enable_if_t< N==0, ErrorCode > | get () &&noexcept |
| |
| template<std::size_t N> |
| std::enable_if_t< N==1, T && > | get () &&noexcept |
| |
template<typename T>
class tmc51x0::Result< T >
Result type for operations that return a value.
- Template Parameters
-
Provides explicit error handling with rich error information. Use the bool operator or IsOk()/IsErr() for checking success.
auto result = driver.GetActualPosition();
if (result) {
float pos = result.Value();
} else {
}
ErrorCode
Error codes for TMC51x0 operations.
Definition tmc51x0_result.hpp:18