err

Macro err 

Source
macro_rules! err {
    ($diagnostic:expr) => { ... };
    ($diagnostic:expr, $fragment:expr) => { ... };
}
Expand description

Macro to create an Err(Error()) from a diagnostic function call

Usage:

  • err!(diagnostic_function(args)) - Creates an Err without fragment
  • err!(diagnostic_function(args), fragment) - Creates an Err with fragment

Expands to: Err(Error(diagnostic_function(args))) or Err(Error(diagnostic_function(args).with_fragment(fragment)))

Examples:

  • err!(sequence_exhausted(Type::Uint8))
  • err!(sequence_exhausted(Type::Uint8), fragment)