Skip to content

Commit 2ef8e76

Browse files
authored
Merge pull request #11 from LuisFerLCC/impl_error_stack
Prepare release 0.1.0
2 parents 4c18c2b + 260e288 commit 2ef8e76

5 files changed

Lines changed: 61 additions & 5 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RELEASE.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# `error-stack-macros2` v0.1.0
2+
3+
The very first development version of `error-stack-macros2` is finally here!
4+
5+
## Features
6+
7+
This version (0.1.0) offers a derive macro for the [`Error`](https://doc.rust-lang.org/stable/core/error/trait.Error.html) trait which encourages the best practices for defining [`error-stack`](https://crates.io/crates/error-stack) context types.
8+
9+
Here's an example. This code:
10+
11+
```rust
12+
use std::{
13+
error::Error,
14+
fmt::{self, Display, Formatter},
15+
};
16+
17+
#[derive(Debug)]
18+
pub enum CreditCardError {
19+
InvalidInput(String),
20+
Other,
21+
}
22+
23+
impl Display for CreditCardError {
24+
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
25+
let msg = match self {
26+
Self::InvalidInput(_) => "credit card not found",
27+
Self::Other => "failed to retrieve credit card",
28+
};
29+
30+
f.write_str(msg)
31+
}
32+
}
33+
34+
impl Error for CreditCardError {}
35+
```
36+
37+
...can now be reduced to this code:
38+
39+
```rust
40+
use error_stack_macros2::Error;
41+
42+
#[derive(Debug, Error)]
43+
pub enum CreditCardError {
44+
#[display("credit card not found")]
45+
InvalidInput(String),
46+
47+
#[display("failed to retrieve credit card")]
48+
Other,
49+
}
50+
```
51+
52+
This new release also means that we will now be listening to feedback and accepting new features (macros, obviously). We are also now committed to maintaining this macro going forward and keeping our dependencies up to date.
53+
54+
## Previous release notes
55+
56+
If you want to take a look at the notes from previous releases, go to [GitHub Releases](https://github.com/LuisFerLCC/error-stack-macros2/releases).

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
| Version | Supported |
66
| ------- | --------- |
7-
| - | - |
7+
| 0.1.0 | |
88

99
## Report a vulnerability
1010

impl/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "error-stack-macros2"
3-
version = "0.0.0-reserved"
3+
version = "0.1.0"
44
authors = ["LuisFerLCC"]
55
edition = "2024"
66
rust-version = "1.90.0"

tests/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "error-stack-macros2-tests"
3-
version = "0.0.0-reserved"
3+
version = "0.1.0"
44
authors = ["LuisFerLCC"]
55
edition = "2024"
66
rust-version = "1.90.0"

0 commit comments

Comments
 (0)