Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ddlog_std: Function to convert Option -> Result.
Add three functions that make working with `Option<>` more ergonomic: ``` /* Transforms the `Option<'T>` into a `Result<'T, 'E>`, * mapping `Some{x}` to `Ok{v}` and `None` to `Err{e}`. */ function ok_or(o: Option<'T>, e: 'E): Result<'T, 'E> /* Transforms `Option<'T>` into `Result<'T, 'E>`, mapping `Some{x} * to `Ok{v}` and `None` to `Err{e()}`. * Function `e` is only evaluated on error. */ function ok_or_else(o: Option<'T>, e: function(): 'E): Result<'T, 'E> /* Returns `None` if the option is `None`, otherwise calls `f` with the * wrapped value and returns the result. */ function and_then(o: Option<'T>, f: function('T): Option<'U>): Option<'U> ```
- Loading branch information