summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-05 13:29:06 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-05 13:29:06 +0200
commitfd44336ef8d0f1dac936d57a8d06f31bb6a3a0ba (patch)
treeeb990f626d24a8b776e7bda56516d70183eea945 /Kernel
parent09dd397160a0081568f964c04db0c55db6cb52d5 (diff)
downloadserenity-fd44336ef8d0f1dac936d57a8d06f31bb6a3a0ba.zip
Kernel: Add KResultOr::release_error()
This is just for symmetry with AK::Result, so that we can use them interchangeably in generic code.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/API/KResult.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/Kernel/API/KResult.h b/Kernel/API/KResult.h
index 95dc9d0089..67521f7575 100644
--- a/Kernel/API/KResult.h
+++ b/Kernel/API/KResult.h
@@ -162,6 +162,12 @@ public:
return released_value;
}
+ [[nodiscard]] KResult release_error()
+ {
+ VERIFY(m_is_error);
+ return m_error;
+ }
+
private:
union {
alignas(T) char m_storage[sizeof(T)];