[][src]Macro skip_error::skip_error_and_log

macro_rules! skip_error_and_log {
    ($result:expr, $log_level:expr) => { ... };
}

skip_error_and_log returns the value of a Result or log and continues a loop.

skip_error_and_log macro takes two parameters. The first argument is of type std::result::Result. The second argument take the log::Level to use for the logging. The macro returns the value if Result::Ok and else, it logs the Result::Error and calls continue.

For example

This code runs with edition 2018
for string_number in &["1", "2", "three", "4"] {
  let number: u32 = skip_error_and_log!(string_number.parse(), log::Level::Warn);
}