Macro skip_error::skip_error_and_debug[][src]

macro_rules! skip_error_and_debug {
    ($result : expr) => { ... };
}
Expand description

skip_error_and_debug returns the value of a Result or log with tracing::Level::DEBUG and continues the loop.

skip_error_and_debug macro takes one parameter which is of type Result.The macro returns the value if Result::Ok and else,it logs the Result::Err with level tracing::Level::DEBUG and calls continue.

For example

for string_number in &["1", "2", "three", "4"] {
  let number: u32 = skip_error_and_debug!(string_number.parse());
}
testing_logger::validate(|captured_logs| {
  assert!(captured_logs[0].body.contains("invalid digit found in string"));
  assert_eq!(captured_logs[0].level, log::Level::Debug);
});