-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no_std
compatibility: handling the 4 incompatible crates
#951
Comments
|
no-std
compatibility: handling the 4 no_std
incompatible crates
no-std
compatibility: handling the 4 no_std
incompatible cratesno_std
compatibility: handling the 4 incompatible crates
Note that we often use the Before: use thiserror::Error;
type Error = anomaly::Error<Kind>;
#[derive(Clone, Debug, Error, PartialEq, Eq)]
enum Kind {
#[error("foo error")]
Foo,
}
fn some_func() -> Result<(), Error> {
if true {
Err(Kind::Foo.context(format!("bar: {}", n)).into())
} else {
Err(Kind::Foo.context("baz").into())
}
} After use displaydoc::Display;
#[derive(Clone, Debug, Display, ...)]
enum Foo {
/// bar: {0}
Baz(i32),
/// baz
Baz
}
#[cfg(feature = "std")]
impl std::error::Error for Foo {}
#[derive(Clone, Debug, Display, ...)]
enum Error {
/// Foo error: {0}
Foo(Foo),
}
#[cfg(feature = "std")]
impl std::error::Error for Error {}
fn some_func(n: i32) -> Result<(), Error> {
if true {
Err(Kind::Foo(Foo::Bar(n)))
} else {
Err(Kind::Foo(Foo::Baz))
}
} |
I'm not sure if the proposed composition of |
That's a good point, thanks! I will investigate to see if we can somehow retain backtraces when |
hi, For anomaly crate, have you some advise? I am try to use anyhow to re-code. |
I have re-code, and meet some error, for |
I was thinking we would not use any error handling library at all, just @soareschen What do you think we should do there? Do you see any value on using |
I am re-code by |
All the problematic dependencies have been removed. So closing this one. |
@romac In ibc-rs module and
dependencies.tendermint
module, there are 4 crates that's incompatible with no-std, as below:If you have any progress of processing the crates above for no-std please update here, thank you.
The text was updated successfully, but these errors were encountered: