Releases: mcmah309/error_set
Releases · mcmah309/error_set
v0.8.4
- Deprecate
ResultContext
andOptionContext
in favor ofErrContext
andNoneContext
for 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_macro
feature 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-fmt
dependency
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
v0.6.3
- Support display for wrapped errors #8 (thanks @duskmoon314)
- Wrapped errors delegate display to the inner error by default
Full Changelog: v0.6.0...v0.6.3
v0.6.0
- Support logging on
#![no_std]
with thedfmt
feature flag - Remove
swallow
logging methods - Refactor logging traits
- Add
ConsumeDisplay
trait - Change the format of the
coerce!
macro
oldnewlet val = coerce!(setx => { Ok(val) => val, Err(SetX::X) => {}, // handle disjointedness { Err(SetX) => return Err(SetY) } // terminal coercion })?;
let val = coerce!{ setx, Ok(val) => val, Err(SetX::X) => {}, // handle disjointedness { Err(SetX) => return Err(SetY) } // terminal coercion }?;
Full Changelog: v0.5.4...v0.6.0