diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-17 10:05:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-17 10:05:07 +0100 |
| commit | 062c4bb508bf6ec7334d374fef2e0e10623b2df9 (patch) | |
| tree | 137a91eb22d1a9207fd4322ced08c3b6388c5eb5 /dev/kernel/NeKit/ErrorOr.h | |
| parent | 36269e57831e560df6a0da9c9d02c00671b0163d (diff) | |
| parent | 791fcd646503f05617f22e6006c115095746da26 (diff) | |
Merge pull request #69 from nekernel-org/dev
release: NeKernel v0.0.7
Diffstat (limited to 'dev/kernel/NeKit/ErrorOr.h')
| -rw-r--r-- | dev/kernel/NeKit/ErrorOr.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/dev/kernel/NeKit/ErrorOr.h b/dev/kernel/NeKit/ErrorOr.h index 3351c65d..2e3afb46 100644 --- a/dev/kernel/NeKit/ErrorOr.h +++ b/dev/kernel/NeKit/ErrorOr.h @@ -2,7 +2,7 @@ * ======================================================== * * NeKernel - * Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. + * Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license. * * ======================================================== */ @@ -13,7 +13,7 @@ #include <NeKit/Ref.h> namespace Kernel { -using ErrorT = UInt32; +using ErrorT = Int32; template <typename T> class ErrorOr final { @@ -22,7 +22,7 @@ class ErrorOr final { ~ErrorOr() = default; public: - explicit ErrorOr(Int32 err) : mRef((T*) RTL_ALLOCA(sizeof(T))), mId(err) {} + explicit ErrorOr(ErrorT err) : mRef((T*) RTL_ALLOCA(sizeof(T))), mId(err) {} explicit ErrorOr(nullPtr) {} @@ -42,8 +42,9 @@ class ErrorOr final { Ref<T>& Leak() { return mRef; } - Int32 Error() { return mId; } + ErrorT Error() { return mId; } + /// @note DO NOT MAKE THIS EXPLICIT! IT WILL BREAK THE COMPILATION. operator bool() { return mRef; } BOOL HasError() { return this->mId > 0; } |
