[ox] Add StringView, Writer system, Preloader system
This commit is contained in:
15
deps/ox/src/ox/std/error.hpp
vendored
15
deps/ox/src/ox/std/error.hpp
vendored
@ -122,6 +122,8 @@ struct Exception: public std::exception {
|
||||
}
|
||||
};
|
||||
|
||||
void panic(const char *file, int line, const char *panicMsg, const Error &err) noexcept;
|
||||
|
||||
template<typename T>
|
||||
struct [[nodiscard]] Result {
|
||||
|
||||
@ -182,6 +184,19 @@ struct [[nodiscard]] Result {
|
||||
return error;
|
||||
}
|
||||
|
||||
constexpr auto &unwrap() noexcept {
|
||||
if (error) {
|
||||
oxPanic(error, "Failed unwrap");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
constexpr const auto &unwrap() const noexcept {
|
||||
if (error) [[unlikely]] {
|
||||
oxPanic(error, "Failed unwrap");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
Reference in New Issue
Block a user