Crates.io | pisserror |
lib.rs | pisserror |
version | 0.3.0-rc.2 |
source | src |
created_at | 2024-07-08 07:32:55.325833 |
updated_at | 2024-11-10 07:36:11.515421 |
description | A golden rip-off of thiserror |
homepage | |
repository | https://github.com/onkoe/pisserror |
max_upload_size | |
id | 1295451 |
size | 23,862 |
A golden replacement for thiserror
.
You'll likely find pisserror
to be pretty familiar. As with thiserror
, it derives Error
for any enum you give to it. Here's a sample of its current usage:
use pisserror::Error;
use std::error::Error; // we don't mess with your prelude :D
#[derive(Debug, Error)]
pub enum DatabaseError {
#[error("encountered a disk error. see: {_0}")]
DiskError(#[from] std::io::Error),
#[error("key `{_0}` has no matching data records")]
KeyNotFound(String),
#[error("attempted to store a malformed header. expected: `{expected:?}`. got: `{got:?}`")]
MalformedHeader {
expected: String,
got: String,
},
#[error("other error: {_0}")]
Other(String),
}
Also, you may wish to note that pisserror
works with #![no_std]
/embedded projects! Just ask cargo add
to not use default features, like cargo add pisserror --no-default-features
.
Alternatively, you can add it to Cargo.toml
by adding default-features = false
:
[dependencies]
pisserror = { version = (your version), default-features = false }
If there's something wrong or missing, please create a GitHub issue! Make sure to thoroughly describe your intentions.
Contributions are welcome! Please create a PR and explain the changes you made.
There are a few ground rules, though:
There are only a few steps to releasing this crate.
README.md
file using cargo-rdme
./Cargo.toml
and /macros/Cargo.toml
.
dependencies.pisserror_macros
section, you must also change the version number to match the new release.cargo publish
!