[ox/std] Add Result::reoriginate functions
This commit is contained in:
+15
@@ -345,6 +345,21 @@ struct [[nodiscard]] Result {
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr Result reoriginate(
|
||||
ErrorCode const pErrCode,
|
||||
CString const pMsg = nullptr,
|
||||
std::source_location const &pSrc = std::source_location::current()) const && noexcept {
|
||||
if (error) {
|
||||
return {std::move(value), Error{pErrCode, pMsg, pSrc}};
|
||||
}
|
||||
return Error{};
|
||||
}
|
||||
|
||||
constexpr Result reoriginate(
|
||||
std::source_location const &pSrc = std::source_location::current()) const && noexcept {
|
||||
return {std::move(value), Error{error.errCode, error.msg, pSrc}};
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
Reference in New Issue
Block a user