-
Notifications
You must be signed in to change notification settings - Fork 47
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
Rust: add support for no_std
env
#205
base: master
Are you sure you want to change the base?
Conversation
4b8eb26
to
3bac661
Compare
@@ -76,7 +76,7 @@ def render_top_matter(out) | |||
// #{@output.relative_source_paths.join("\n// ")} | |||
EOS | |||
out.break | |||
out.puts "#![allow(clippy::missing_errors_doc, clippy::unreadable_literal)]" | |||
out.puts "#![allow(clippy::missing_errors_doc, clippy::unreadable_literal, clippy::needless_question_mark)]" |
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.
I did not modify the relevant code, so I am not sure why clippy is giving a warning. And I encountered some difficulties in fixing this warning, so let's add it first.
no_std
env
Thanks for looking into this. Why I noticed that we're using Rather than add a generic sounding 'alloc' feature to the stellar-xdr crate, I'm inclined to instead add a feature named after the optional dependency. So if you enable the embedded-io feature, you get embedded-io capability. We need to think about how to test this for consistency with the std::io behavior. The xdr lib depends on the std::io::Read::read_exact function, and it's default_read_exact implementation, and it has some subtle interactions with reading EOF safeties in the xdr lib. But I notice that the embedded-io read_exact function isn't identical, and so I think we'll be hesitant to merge changes unless we can either avoid the difference, or do some differential fuzzing to ensure there's no breakage or observable difference in behavior. |
Hi @leighmcculloch, thank you for taking the time to review the PR.
I researched the following libraries:
I will create an issue to ask if they would consider adding
I like this idea, so that embedded-io will only be used when the user explicitly enables it.
I need to do a bit more research. If I have any questions, can I reach out to you on Discord? |
@@ -2767,3 +2816,335 @@ mod test { | |||
assert_eq!(v.to_option(), Some(1)); | |||
} | |||
} | |||
|
|||
#[cfg(all(test, any(feature = "std", feature = "embedded_io")))] |
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.
I added some tests to verify whether the behavior of embedde io meets expectations.
Enable rs-stellar-xdr to encode/decode XDR in a
no_std
environment.See stellar/rs-stellar-xdr#392