-struct result {
- char const *e;
- optional<T> t;
-
- bool is_ok() const { return this->t != nullopt; }
- bool is_err() const { return this->e != nullptr; }
-
- T unwrap() {
- if (this->e != nullptr) {
- throw std::logic_error(this->e);
- }
- return this->t.value();
- }
-
- operator T() { return this->unwrap(); }
-
- char const *unwrap_err() { return this->e; }
-
- optional<T> const &ok() const { return this->t; }
- optional<char const *> err() const {
- return this->e ? optional<char const *>(this->e) : nullopt;
- }
-
- result<T> map_err(std::function<char const *(char const *)> f);
+struct result
+{
+ char const *e;
+ optional<T> t;
+
+ bool is_ok() const { return this->t != nullopt; }
+ bool is_err() const { return this->e != nullptr; }
+
+ T unwrap()
+ {
+ if (this->e != nullptr)
+ {
+ throw std::logic_error(this->e);
+ }
+ return this->t.value();
+ }
+
+ operator T() { return this->unwrap(); }
+
+ char const *unwrap_err() { return this->e; }
+
+ optional<T> const &ok() const { return this->t; }
+ optional<char const *> err() const
+ {
+ return this->e ? optional<char const *>(this->e) : nullopt;
+ }
+
+ result<T> map_err(std::function<char const *(char const *)> f);