Live data from Hacker News

Getting Started with Tokio

lukesteensen.com

1–10 of 22 posts

Re: Getting Started with Tokio

#4
Thanks for writing this. I often find it difficult to wrap my head around some of these crates if I'm unfamiliar with the problem space. Often times if you haven't tried building a server before you won't know why you would use a crate like this. Having a high level overview of what you might use it for and a simple walked through example is really helpful.

Re: Getting Started with Tokio

#5
I've been following futures since the announcement blog post came out (and had been using rust for several months before that) and I've never found a group of crates that intermix so well together. Simple stuff like tokio-tls implementing the Io trait from tokio-core so it can easily be used in bind_transport to secure the connection makes working with tokio and futures so nice. Thanks so much to the people working on this!

Re: Getting Started with Tokio

#6
post #3

The whole tokio stack is having an initial 0.1 release soon. It's incredibly highly anticipated.

I'm waiting to refactor four of my services to use tokio + hyper + amqp as soon as possible. It'll be fun...

Are you expecting to see any benefits from the async stuff in particular?

Re: Getting Started with Tokio

#7
>You can ignore all of the Box stuff; the reasoning behind that isn't terribly important right now.

What is the reason to box the futures? futures::finished and futures::failed both return FutureResult.

Re: Getting Started with Tokio

#8
post #6
post #3

Earlier quoted context omitted.

I'm waiting to refactor four of my services to use tokio + hyper + amqp as soon as possible. It'll be fun...

Are you expecting to see any benefits from the async stuff in particular?

I'm mostly doing IO in these services and now I scale them up with threads and processes. I'm not using CPU so much so I could live with a small amount of threads doing async IO, because I don't need to process the messages in sync anyways. I have plenty of RAM to spare and could live with bigger memory usage.

Re: Getting Started with Tokio

#9
post #5

I've been following futures since the announcement blog post came out (and had been using rust for several months before that) and I've never found a group of crates that intermix so well together. Simple stuff like tokio-tls implementing the Io trait from tokio-core so it can easily be used in bind_transport to secure the connection makes working with tokio and futures so nice. Thanks so much to the people working o…

When I can add some of these libraries to my projects, it's like a late Christmas gift for sure!

Thank you for the whole team.

Re: Getting Started with Tokio

#10
post #7

>You can ignore all of the Box stuff; the reasoning behind that isn't terribly important right now. What is the reason to box the futures? futures::finished and futures::failed both return FutureResult.

In general, Future is a trait, which means if you want to return a Future, you have to either create a trait object, or use the nightly-only "-> impl Trait". Boxing is the most straightforward way of creating a trait object.

(I haven't dug into the specifics of this specific example; that's what I assumed when I read that line. Maybe the author also knew this rule of thumb and did it unnecessarily...)

Post reply on HN