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

io: read/write big-endian numbers #1863

Merged
merged 2 commits into from
Nov 30, 2019
Merged

io: read/write big-endian numbers #1863

merged 2 commits into from
Nov 30, 2019

Conversation

carllerche
Copy link
Member

Provide convenience methods for encoding and decoding big-endian numbers
on top of asynchronous I/O streams. Only primitive types are provided
(24 and 48 bit numbers are omitted).

In general, using these methods won't be the fastest way to do
encoding/decoding with asynchronous byte streams, but they help to get
simple things working fast.

Provide convenience methods for encoding and decoding big-endian numbers
on top of asynchronous I/O streams. Only primitive types are provided
(24 and 48 bit numbers are omitted).

In general, using these methods won't be the fastest way to do
encoding/decoding with asynchronous byte streams, but they help to get
simple things working fast.
};
($name:ident, $ty:ty, $reader:ident, $bytes:expr) => {
pin_project! {
#[doc(hidden)]
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

These doc(hidden) make me sad, since they mean the user can't even see that the return type is impl Future.

Copy link
Member Author

Choose a reason for hiding this comment

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

I’m fine exposing more types, but this reminds me that I’ve been adding an “equivalent” async fn definition in docs.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm hesitant to re-export futures as, in theory, one day we will be able to use real async fn here.

That said, since it is 0.2, we can re-export them for now.

@carllerche
Copy link
Member Author

I updated the docs to include an "equivalent async fn"

@carllerche carllerche merged commit 1ea6733 into master Nov 30, 2019
@carllerche carllerche deleted the read-byte-order branch December 2, 2019 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants