-
Notifications
You must be signed in to change notification settings - Fork 11
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
Support no_std
in hexf-parse.
#28
base: master
Are you sure you want to change the base?
Conversation
Support `no_std` in hexf-parse, by adding a "std" feature, enabled by default, and putting the impl of `std::error::Error` behind it.
ps looks like |
I've now updated the PR to use |
#[cfg(feature = "std")] | ||
impl std::error::Error for ParseHexfError { | ||
fn description(&self) -> &'static str { | ||
self.text() | ||
} | ||
} | ||
|
||
#[cfg(not(feature = "std"))] | ||
impl core::error::Error for ParseHexfError { | ||
fn description(&self) -> &'static str { | ||
self.text() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be simply replaced to core::error::Error
? Otherwise are those different types?
#[cfg(feature = "std")] | |
impl std::error::Error for ParseHexfError { | |
fn description(&self) -> &'static str { | |
self.text() | |
} | |
} | |
#[cfg(not(feature = "std"))] | |
impl core::error::Error for ParseHexfError { | |
fn description(&self) -> &'static str { | |
self.text() | |
} | |
} | |
impl core::error::Error for ParseHexfError { | |
fn description(&self) -> &'static str { | |
self.text() | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The README.md advertises support for Rust 1.43; core::error::Error
was introduced in Rust 1.81.
Support
no_std
in hexf-parse, by adding a "std" feature, enabled by default, and putting the impl ofstd::error::Error
behind it.