mirror of
https://github.com/logos-storage/questionable.git
synced 2026-01-03 06:13:09 +00:00
Overload toOption for Result
Necessary for the `=?` operator to work.
This commit is contained in:
parent
24a2e4eae6
commit
5d9d6f0fae
@ -116,6 +116,11 @@ proc option*[T,E](value: Result[T,E]): ?T =
|
||||
else:
|
||||
T.none
|
||||
|
||||
template toOption*[T, E](value: Result[T, E]): ?T =
|
||||
## Converts a Result into an Option.
|
||||
|
||||
value.option
|
||||
|
||||
proc errorOption*[T, E](value: Result[T, E]): ?E =
|
||||
## Returns an Option that contains the error from the Result, if it has one.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user