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

Box::pin vs pin_mut!(s); #25

Open
kornelski opened this issue Feb 10, 2020 · 1 comment
Open

Box::pin vs pin_mut!(s); #25

kornelski opened this issue Feb 10, 2020 · 1 comment

Comments

@kornelski
Copy link

Requiring pin_mut!(s); at the usage site may be efficient, but it is an awkward requirement for users of such API.

I've found that wrapping returned stream in Box::pin makes it "just work". I suspect that for network-bound streams the overhead will be negligible.

Could you mention this alternative in the docs?

@LucioFranco
Copy link
Member

@kornelski I think the prefered usage is using pin_mut or tokio::pin but I think we could shoutout box::pin in the docs, would you possibly be able to PR this? :)

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 a pull request may close this issue.

2 participants