Extract some value from the query result, unless it's not found or other error.
(res: AbciQuery, f: F)
| 189 | |
| 190 | /// Extract some value from the query result, unless it's not found or other error. |
| 191 | fn extract_opt<T, F>(res: AbciQuery, f: F) -> anyhow::Result<Option<T>> |
| 192 | where |
| 193 | F: FnOnce(AbciQuery) -> anyhow::Result<T>, |
| 194 | { |
| 195 | if is_not_found(&res) { |
| 196 | Ok(None) |
| 197 | } else { |
| 198 | extract(res, f).map(Some) |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | /// Extract some value from the query result, unless there was an error. |
| 203 | fn extract<T, F>(res: AbciQuery, f: F) -> anyhow::Result<T> |
no test coverage detected