Releases: mcmah309/error_set
Releases · mcmah309/error_set
v0.9.1
What's Changed
- Fix expansion of unit error structs by including semicolon token from input by @reivilibre in #37
New Contributors
- @reivilibre made their first contribution in #37
Full Changelog: v0.9.0...v0.9.1
v0.9.0
What's Changed
- Breaking: new declaration syntax. Use
:=(is defined as) instead of=and remove ending;error_set! { ErrorEnum := { Variant1, Variant2, } }
- Breaking: err_trail re-exported feature flags were removed (
tracing,log,defmt). Addto yourerr_trail = { version = "0.9", features = [ # features here ] }
Cargo.tomldirectly if were using them. - Breaking:
disablerenamedskiphttps://github.com/mcmah309/error_set?tab=readme-ov-file#disabling-automatic-trait-implementations - Error structs are now supported #26
- Automatic From's for Boxing #31
- Shorthand Error Variant Syntax #29
- Integration guide with
eroshttps://github.com/mcmah309/error_set?tab=readme-ov-file#eros - Adds
no_stdsupport forErrContextby @baloo in #34
New Contributors
Full Changelog: v0.8.4...v0.9.0
v0.8.4
- Deprecate
ResultContextandOptionContextin favor ofErrContextandNoneContextfor feature flags- Break feature out into separate crate err_trail that can be used independent of
error_set
- Break feature out into separate crate err_trail that can be used independent of
- fix: changed all_cfg_attributes to a HashSet ... by @lanastara in #25
- Improve error messages for invalid syntax
- Support nested generics
New Contributors
- @lanastara made their first contribution in #25
Full Changelog: v0.8.3...v0.8.4
v0.8.3
v0.8.1
Selective Disables For From
From now accepts arguments to only disable certain From implementations. e.g.
error_set! {
U = {
IoError(std::io::Error),
};
V = {
FmtError(std::fmt::Error),
IoError(std::io::Error),
};
#[disable(From(std::io::Error, U))]
W = V || U;
}Full Changelog: v0.8...v0.8.1
v0.8.0
Generics
error_set now supports generics. e.g.
error_set! {
X<G: Debug> = {
A {
a: G
}
};
Y<H: Debug> = {
B {
b: H
}
};
Z<T: Debug> = X<T> || Y<T>;
}In Z<T: Debug> = X<T> || Y<T>; T will replace G in X - X<T: Debug>. Thus this statement is the
same as writing
error_set! {
...
Z<T: Debug> = {
A {
a: T
},
B {
b: T
}
};
}Disable
error_set auto-implements From, Display, Debug, and Error for the set. If it is ever desired to disable
this. Add #[disable(..)] to the set. e.g.
error_set! {
#[disable(Display,Debug)]
X = {
A,
};
}
impl Display for X {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "X")
}
}
impl Debug for X {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "X")
}
}Breaking
If two variants share the same source, the From implementation will not automatically be generated.
Full Changelog: v0.7.0...v0.8.0
v0.7.0
- Multiple source variants of the same type are now supported. See here for more.
error_set! {
ErrorEnum = {
IoError(std::io::Error),
IoError2(std::io::Error),
};
}- Source struct variants are now supported. See here for more.
error_set! {
ErrorEnum = {
IoError(std::io::Error) {
field1: String,
field2: &'static str,
}
};
}coerce_macrofeature removed.
Full Changelog: v0.6.6...v0.7.0
v0.6.6
v0.6.5
- Display messages now support inline interpolation
// Shorthand for `#[display("User `{}` with role `{}` does not exist", name, role)]`
#[display("User `{name}` with role `{role}` does not exist")] - Remove
dyn-fmtdependency
Full Changelog: v0.6.4...v0.6.5
v0.6.4
#![no_std]display messages can now refer to fields
Full Changelog: v0.6.3...v0.6.4