Function swipl::result::attempt_opt
source · pub fn attempt_opt<R>(r: PrologResult<R>) -> OptPrologResult<R>
Expand description
Transforms a PrologResult into an OptPrologResult, allowing more easy use from an if block.
Example:
if let Some(num) = attempt_opt(term.get::<u64>())? {
// term contained an u64
} else {
// term did not contain an u64
}