Trait unwrap::VerboseUnwrap [] [src]

pub trait VerboseUnwrap {
    type Wrapped;
    fn verbose_unwrap(
        self,
        message: Option<Arguments>,
        module_path: &str,
        file: &str,
        line_number: u32,
        column: u32
    ) -> Self::Wrapped; }

Types which can be unwrapped and which may want to print a verbose error message when they are unwrapped incorrectly. This trait is implemented for Result and Option as a replacement for their inherent unwrap methods. This trait is intended to be used via this crate's unwrap! macro.

Associated Types

The wrapped type.

Required Methods

Unwrap the value into it's inner type or panicks with an error message when the value cannot be unwrapped. This method is intended to be called via this crate's unwrap! macro.

Panics

When the value cannot be unwrapped. Eg. on an Err or None value.

Arguments

These arguments are used to print a useful diagnostic when the method panicks.

  • message: An optional message, printed alongside the rest of the info.
  • module_path: The module path where this method is being called from. Eg. my_crate::my_module::my_function
  • file: The filename where this method is being called from.
  • line_number: The line number where this method is being called from.
  • column: The column number where this method is being called from

Implementors