Rust-style Option and Result Classes for PHP
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore(README.md): update roadmap

Ciaran 74b56604 752331cc

+23 -6
+23 -6
README.md
··· 12 12 13 13 This library contains two classes: `Option<T>` and `Result<T,E>`. 14 14 15 - Which is [appropriate for your use case]? 15 + Which is appropriate for your use case? 16 16 - You have one failure mode: `Option` 17 17 - Two have two or more failure modes: `Result` 18 18 ··· 71 71 72 72 - Add useful methods 73 73 - Option 74 + - [x] `Some()` 75 + - [x] `None()` 76 + - [x] `isSome()` 77 + - [x] `isNone()` 78 + - [x] `unwrap()` 79 + - [x] `unwrapOr()` 74 80 - [x] `map()` 75 - - [ ] `unwrapOrElse()` 76 - - [ ] `expect(string $message)` 77 - - [ ] `andThen(callback $fn)` 81 + - [ ] `mapOr()` - Returns contained value or computes from closure 82 + - [ ] `mapOrElse(callback $default, callback $fn)` - Map with lazy default function 83 + - [ ] `filter(callback $predicate)` - Keep Some only if predicate returns true 84 + - [ ] `unwrapOrElse()` - Returns contained value or computes from closure 85 + - [ ] `expect(string $message)` - Returns contained value or panics with custom error message 86 + - [ ] `andThen(callback $fn)` - Returns result of `fn(contained value)` if some, or returns none 78 87 - Result 88 + - [x] `Ok()` 89 + - [x] `Err()` 90 + - [x] `isOk()` 91 + - [x] `isErr()` 92 + - [x] `getOk()` 93 + - [x] `getErr()` 79 94 - [x] `unwrap()` 80 - - [ ] `unwrapOrElse()` 81 95 - [x] `unwrapErr()` 82 96 - [x] `unwrapOr(mixed $default)` 83 97 - [x] `map()` 84 98 - [x] `mapErr()` 99 + - [ ] `mapOr()` - Returns contained value or computes from closure 100 + - [ ] `mapOrElse(callback $default, callback $fn)` - Map with lazy default function 101 + - [ ] `unwrapOrElse()` 85 102 - [ ] `expect(string $message)` 86 103 - [ ] `expectErr(string $message)` 87 104 - [ ] `andThen(callback $fn)` 88 - - [ ] `safe(throwable $fn, callback $onMapErr)` could be cool 105 + - [ ] `tryCatch(callback $tryFn, callback $onMapErr)` - Returns Ok if operation is successful or calls onMapErr with the Err if it throws 89 106 90 107 ## Contributing 91 108