Skip to main content

StackError

Derive Macro StackError 

Source
#[derive(StackError)]
{
    // Attributes available to this derive:
    #[stack]
}
Expand description

Derives the StackError trait for a struct or enum.

Requires a Location field in every struct/variant (added automatically by #[suzunari_error]). The location field is resolved by:

  1. #[stack(location)] marker — highest priority, supports any field name
  2. Single field of type Location — automatic fallback
  3. Error if neither is found

When using #[suzunari_error], #[suzu(location)] on a field becomes #[stack(location)] + #[snafu(implicit)].

Also generates From<T> for BoxedStackError when the alloc feature is enabled.