-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
migrate to futures-0.3 #185
Comments
Thanks for posting. I haven't taken a specific look yet. I'm aware that things are changing. I'm was planning on waiting until interfaces stabilize to minimize the amount of breaking changes I'd have to make in these interface. Once hyper is finished this crate mostly gets the upgrade for free. |
fair enough. Just to clarify, while async/await syntax is not stabilised yet, std::future is stabilised. Meaning that the interface is already stable. I agree that it's probably worth waiting. async/await will probably lead to a bit of a refactor too- it's not just a new syntax, it also adds some handy borrowing semantics for futures, so you don't need to clone objects and pipe them through multiple futures anymore https://github.com/rust-lang/rust/labels/AsyncAwait-Blocking |
I've started playing around with this in the above pull request. The upgrade is a hell of a long way from 'free', turns out. The async await syntax simplifies a lot of methods which return futures, which is nice. Doesn't do so much to simplify the methods which return streams (there's no equivalent syntax for streams as yet). |
Now that async/await syntax is stabilized and hyper supports futures-0.3, what is the latest progress on this issue?
The current way to iterate through a stream in an async function looks like: while let Some(item) = stream.next().await? {
// async processing
} |
@vincent-163 There is this open PR: #191 |
what you don't get is lifetime elision. you also need to wrap any stream manipulation functions in async blocks. async closures are not yet supported. Additionally, at the time this issue was opened also, i think the syntax you're looking for is while let Some(item) = stream.next().await {
let item = item?;
// async processing
} also, first you have to pin it to the stack, and then you have to wrap it in an async block, and then you have to write out explicit lifetimes in your return types. And you'll end up adding I'm no longer working on this- but the pull request above is largely complete if anyone's looking to pick it up. My refactoring got a bit drastic, and out of scope of the pull request, so I gave it up. Working slowly on a new docker client with my proposed syntax, and async-await support. will post here when i have an update. I think the best way forward for shiplift is to branch off master into an |
i'm revisiting this, given i've got a tiny bit of extra time on my hands during the lockdown... https://github.com/danieleades/longshoreman given the sheer volume of endpoints to cover, i'm absolutely looking for feedback on which ones people need, and for pull requests to add them. The core logic of the HTTP client is implemented, and uses the latest Hyper, async/await, etc. |
I am currently managing my dockers with |
@danieleades Thank you! But your crate is not fully developed. I want to manage volumes and execute some commands in my containers. |
It's far from fully developed, but if you can tell me what you need implemented, I can make sure that gets added next! Alternatively, you can use this crate with a compat layer. |
Any plans to move to a futures-0.3 API?
This would allow easy interop with the async/await syntax.
The downside of course is that it's not quite stabilised, so could only target nightly.
Hyper has just about finished migrating, but even before that shiplift can start returning std::futures using the compat layer.
The text was updated successfully, but these errors were encountered: