Skip to main content

at

Macro at 

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

Start tracing an error with crate metadata for repository links.

Requires define_at_crate_info!() or a custom at_crate_info() function.

§Setup (once in lib.rs)

whereat::define_at_crate_info!();

§Usage

use whereat::{at, At};

fn find_user(id: u64) -> Result<String, At<MyError>> {
    if id == 0 {
        return Err(at!(MyError::NotFound));
    }
    Ok(format!("User {}", id))
}

§Without Crate Info

If you don’t need GitHub links, use the at() function instead:

use whereat::{at, At};

#[derive(Debug)]
struct MyError;

let err: At<MyError> = at(MyError);  // No crate info, no getter needed