mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 18:37:36 +00:00
Kernel: Add KResultOr<T>::result()
This is just a handy way to get either an error or a KSuccess, even if there is a T present.
This commit is contained in:
parent
745ea2a0ef
commit
2f82d4fb31
1 changed files with 3 additions and 2 deletions
|
@ -119,6 +119,7 @@ public:
|
||||||
ASSERT(m_is_error);
|
ASSERT(m_is_error);
|
||||||
return m_error;
|
return m_error;
|
||||||
}
|
}
|
||||||
|
KResult result() const { return m_is_error ? KSuccess : m_error; }
|
||||||
T& value()
|
T& value()
|
||||||
{
|
{
|
||||||
ASSERT(!m_is_error);
|
ASSERT(!m_is_error);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue