summaryrefslogtreecommitdiffhomepage
path: root/include/CompilerKit/ErrorOr.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-12-08 01:57:30 -0500
committerAmlal El Mahrouss <amlal@nekernel.org>2025-12-08 01:57:30 -0500
commit2ddaf86857828500235e8b8a65c11bb2dd91b8be (patch)
tree46899c14955bf356be2331e63c181afd4089d982 /include/CompilerKit/ErrorOr.h
parent9f7c44f1577f194cb76b03ac45a2af542a86c8b9 (diff)
chore! breaking API changes and new APIs introduced.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'include/CompilerKit/ErrorOr.h')
-rw-r--r--include/CompilerKit/ErrorOr.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/CompilerKit/ErrorOr.h b/include/CompilerKit/ErrorOr.h
index 100624e..db8339a 100644
--- a/include/CompilerKit/ErrorOr.h
+++ b/include/CompilerKit/ErrorOr.h
@@ -29,6 +29,8 @@ class ErrorOr final {
~ErrorOr() = default;
public:
+ using RefType = Ref<T>;
+
explicit ErrorOr(ErrorT err) : mId(err) {}
explicit ErrorOr(std::nullptr_t null) {}
explicit ErrorOr(T klass) : mRef(klass) {}
@@ -36,7 +38,7 @@ class ErrorOr final {
ErrorOr& operator=(const ErrorOr&) = default;
ErrorOr(const ErrorOr&) = default;
- Ref<T>& Leak() { return mRef; }
+ RefType& Leak() { return mRef; }
ErrorT Error() { return mId; }
@@ -45,8 +47,8 @@ class ErrorOr final {
explicit operator bool() { return mRef; }
private:
- Ref<T> mRef;
- ErrorT mId{0};
+ RefType mRef;
+ ErrorT mId{0};
};
using ErrorOrAny = ErrorOr<VoidPtr>;