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

Improved send_file.rs example to use streaming. #3433

Merged
merged 8 commits into from Nov 21, 2023

Conversation

acedogblast
Copy link
Contributor

@acedogblast acedogblast commented Nov 20, 2023

This is to show what I have wrote so far. It does not compile in the current state.
This addresses issues #3432

Copy link
Member

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

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

So far I noticed these two changes.

examples/send_file.rs Outdated Show resolved Hide resolved
examples/send_file.rs Outdated Show resolved Hide resolved
acedogblast and others added 2 commits November 20, 2023 17:36
Co-authored-by: Sean McArthur <sean@seanmonstar.com>
Co-authored-by: Sean McArthur <sean@seanmonstar.com>
@acedogblast
Copy link
Contributor Author

We still have build errors:
line 82 mismatched types
expected StreamBody<_>, found ReaderStream<File>

and line 61 mismatched types
expected Response<BoxBody<Bytes, Error>>, found Response<BoxBody<_, Infallible>>

examples/send_file.rs Outdated Show resolved Hide resolved
Co-authored-by: Sean McArthur <sean@seanmonstar.com>
@seanmonstar
Copy link
Member

You'll need to use map_err(|e| e as _) on the Full, and you'll need to import StreamExt and use .map_ok(Frame::data) on the ReaderStream before it can be converted into a StreamBody.

@acedogblast
Copy link
Contributor Author

I am not sure what you mean by map_err(|e| e as _) on the Full .
Also are you referring to StreamExt from the tokio-stream crate(https://docs.rs/tokio-stream/latest/tokio_stream/trait.StreamExt.html)?

Copy link
Member

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

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

I've tested out all the rest of the changes I'm suggested, and it works at the end.

examples/send_file.rs Outdated Show resolved Hide resolved
examples/send_file.rs Outdated Show resolved Hide resolved
examples/send_file.rs Outdated Show resolved Hide resolved
acedogblast and others added 3 commits November 20, 2023 18:40
Co-authored-by: Sean McArthur <sean@seanmonstar.com>
Co-authored-by: Sean McArthur <sean@seanmonstar.com>
Co-authored-by: Sean McArthur <sean@seanmonstar.com>
@acedogblast
Copy link
Contributor Author

I can also confirm that it builds and works. Now ready to pull.

@seanmonstar seanmonstar merged commit ea8dffe into hyperium:master Nov 21, 2023
20 checks passed
0xE282B0 pushed a commit to 0xE282B0/hyper that referenced this pull request Jan 16, 2024
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

2 participants