[ox] Add StringView, Writer system, Preloader system

This commit is contained in:
2022-11-30 01:45:11 -06:00
parent 98f35140fe
commit cbb496c59f
64 changed files with 2343 additions and 417 deletions

View File

@ -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 {