macro_rules! polonius_try {
    ( $e:expr $(,)? ) => { ... };
}
Expand description

Perform the ? operation (on Results). See polonius! for more info.

Example

use {
   ::polonius_the_crab::prelude::*,
   ::std::collections::HashMap,
};

enum Error { /* … */ }

fn fallible_operation (value: &'_ i32)
  -> Result<(), Error>
{
    // …
}

fn get_or_insert (
   mut map: &'_ mut HashMap<i32, i32>,
) -> Result<&'_ i32, Error>
{
   polonius!(|map| -> Result<&'polonius i32, Error> {
       if let Some(value) = map.get(&22) {
           // fallible_operation(value)?;
           polonius_try!(fallible_operation(value));
           polonius_return!(Ok(value));
       }
   });
   map.insert(22, 42);
   Ok(&map[&22])
}