summaryrefslogtreecommitdiff
path: root/AK/Result.h
AgeCommit message (Collapse)Author
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.