fack
Declarative Rust error derivation with no_std support and zero allocation in generated runtime code.
use *;
Installation
[]
= "0.4.0"
Import the prelude to bring both the derive macro and core::error::Error into scope.
use *;
Formatting
Use a format string to implement Display.
Named fields can be captured directly.
use *;
Tuple fields use positional captures.
use *;
;
Explicit Rust expressions are accepted as format arguments.
use *;
Positional expressions are also supported.
use *;
Dynamic width and precision may reference fields through normal Rust format syntax.
use *;
Custom display
Use display(path) when formatting belongs in a formatter function.
use *;
Error sources
Use source(field) to expose an ordinary error source.
use *;
Direct, boxed, optional, and optional boxed sources are supported.
use *;
Transparent errors
Use transparent(field) to forward Display and source chaining through one non-optional error field.
Additional fields may retain context.
use *;
Conversion with From
Use from on a declaration with exactly one field. It generates From<T> and uses that field as the ordinary source.
use *;
;
The same form works on enum variants.
use *;
Enum errors
Each variant declares its own display, source, transparency, or conversion behavior.
use *;
Generation options
Without an inline declaration, generated methods receive no explicit inline attribute.
#[error(inline)] and #[error(inline(neutral))] emit ordinary #[inline]. The always and never strategies emit the corresponding Rust attributes.
use *;
;
Generated paths use ::core by default. Use import(path) to select another root.
use *;
;
Enum-wide generation options belong on the enum.
use *;
no_std
Generated implementations use core by default, so the facade can be used from no_std crates without switching import roots.
use *;
Associated crates
fackprovides the user-facing facadefack-corereserves the foundationalno_stdAPI boundaryfack-macroprovides the derive macrofack-codegenprovides the standalone Syn 3 code generation API
License
GPL-3.0
Copyright (C) 2025 W. Frakchi
This program is free software. You can redistribute it and modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License or any later version.
See LICENSE.md for the full text.