summaryrefslogtreecommitdiff
path: root/AK/Result.h
AgeCommit message (Collapse)Author
2021-11-28AK: Allow to "get a result" from Result<void>Hendiadyoin1
This is to make Result<void> work inside TRY
2021-05-08AK: Let Result<T, E> know its Value and Error typesAli Mohammad Pur
It's much easier to ask for T::ValueType than for RemoveReference<decltype(declval<T>().release_value())>
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-01AK: Fix bogus return type of Result::release_error() (#6054)vcollette
The function was not used anywhere so the error was unnoticed.
2021-01-09AK: Add release_value() and release_error() to AK::ResultAndreas Kling
These are nice when you want to move something out of the result, and match the API we already have for Optional.
2021-01-01AK: Add Result<void, ErrorType> specialization, cleanupAndrew Kaster
Add a specialization for a void ValueType. This is useful if a generic function wants to return a Result<T, E> where the user might not actually care abut the T, and default it to void. In this case it basically becomes Unexpected<E> instead of Result, but hey, it works :)
2020-12-31Everywhere: Re-format with clang-format-11Linus Groh
Compared to version 10 this fixes a bunch of formatting issues, mostly around structs/classes with attributes like [[gnu::packed]], and incorrect insertion of spaces in parameter types ("T &"/"T &&"). I also removed a bunch of // clang-format off/on and FIXME comments that are no longer relevant - on the other hand it tried to destroy a couple of neatly formatted comments, so I had to add some as well.
2020-10-03AK: Make Buffered<T> non-copyable.asynts
2020-09-25Meta+AK: Make clang-format-10 cleanBen Wiederhake
2020-08-05AK: Decorate AK::Result<V, E> with [[nodiscard]]Brian Gianforcaro
2020-04-21AK: Simplify Result class so we can start using itAndreas Kling
There were some ideas about how to use this class but we never actually started using it, so let's just simplify it and get it ready for use. The basic idea is: a function returns a Result<ValueType, ErrorType>. Callers check if the result object is_error(). If so, an ErrorType can be fetched with the error() getter. Otherwise, a ValueType is fetched with the value() getter. That's it. :^)
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2019-07-31Add Result<>, to use with/complement ErrorRobin Burchell
An operation often has two pieces of underlying information: * the data returned as a result from that operation * an error that occurred while retrieving that data Merely returning the data is not good enough. Result<> allows exposing both the data, and the underlying error, and forces (via clang's consumable attribute) you to check for the error before you try to access the data.