MCPcopy Create free account
hub / github.com/consensus-shipyard/ipc / extract_opt

Function extract_opt

fendermint/rpc/src/query.rs:191–200  ·  view source on GitHub ↗

Extract some value from the query result, unless it's not found or other error.

(res: AbciQuery, f: F)

Source from the content-addressed store, hash-verified

189
190/// Extract some value from the query result, unless it's not found or other error.
191fn extract_opt<T, F>(res: AbciQuery, f: F) -> anyhow::Result<Option<T>>
192where
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.
203fn extract<T, F>(res: AbciQuery, f: F) -> anyhow::Result<T>

Callers 2

ipldMethod · 0.85
extract_actor_stateFunction · 0.85

Calls 2

is_not_foundFunction · 0.85
extractFunction · 0.85

Tested by

no test coverage detected