You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.
I found another solution in the zstd crate. They use derive_more with a feature flag to derive Error only on std. This makes would allow no_std on stable but without the Error trait. Something to think of.
#[derive(Debug, derive_more::Display, derive_more::From)]#[cfg_attr(feature = "std", derive(derive_more::Error))]#[non_exhaustive]pubenumFoo{#[display(fmt = "Bar occurred. Is: {baz}, must be either 1 or 2")]Bar{baz:u8},//...}
The attributes on the enum tags are quite similar to thiserror so it wouldn't be too hard to switch between the two crates.
The text was updated successfully, but these errors were encountered:
Brief feature description
The error handling strategy must be documented.
enum
s as error codesenum
error codes of an higher architectural levelstd::error::Error
and later (when it is in stable)core::error::Error
is implemented for all error enums.The issue shall be concluded with a markdown file explaining the above points and showing some code snippets to illustrate them.
Detailed information
From @elBoberido
I found another solution in the zstd crate. They use
derive_more
with a feature flag to deriveError
only on std. This makes would allowno_std
on stable but without theError
trait. Something to think of.They basically did this
The attributes on the enum tags are quite similar to
thiserror
so it wouldn't be too hard to switch between the two crates.The text was updated successfully, but these errors were encountered: