Skip to content
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

Add no-std feature; impl Display on Error #19

Merged
merged 1 commit into from
Jun 1, 2020

Conversation

ionut-arm
Copy link
Member

This commit adds a no-std feature that controls whether the crate
exposes any functionality that makes use of the standard library. The
feature is enabled by default.

In "std"-mode, the Display and Error traits are implemented on the
Error enum.

Signed-off-by: Ionut Mihalcea [email protected]

@ionut-arm ionut-arm added the enhancement New feature or request label Jun 1, 2020
@ionut-arm ionut-arm requested a review from hug-dev June 1, 2020 13:20
@ionut-arm ionut-arm self-assigned this Jun 1, 2020
Copy link
Member

@hug-dev hug-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

psa-crypto/src/types/status.rs Outdated Show resolved Hide resolved
with-mbed-crypto = ["psa-crypto-sys"]
no-std = []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would one compile this crate with only the no-std feature activated? Would it be like:

cargo build --no-default-features --features no-std

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, precisely!

@@ -89,6 +94,73 @@ pub enum Error {
InvalidHandle,
}

#[cfg(not(feature = "no-std"))]
impl fmt::Display for Error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👏

This commit adds a no-std feature that controls whether the crate
exposes any functionality that makes use of the standard library. The
feature is enabled by default.

In "std"-mode, the Display and Error traits are implemented on the
`Error` enum.

Signed-off-by: Ionut Mihalcea <[email protected]>
Copy link
Member

@hug-dev hug-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙆‍♂️

@ionut-arm ionut-arm merged commit 47f389b into parallaxsecond:master Jun 1, 2020
@ionut-arm ionut-arm deleted the no-std branch June 1, 2020 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants