Skip to content
This repository has been archived by the owner on Sep 13, 2018. It is now read-only.

Add a way to combine multiple Parse and Serialize #63

Closed
Yamakaky opened this issue Oct 6, 2016 · 7 comments
Closed

Add a way to combine multiple Parse and Serialize #63

Yamakaky opened this issue Oct 6, 2016 · 7 comments
Labels

Comments

@Yamakaky
Copy link

Yamakaky commented Oct 6, 2016

Like serde + framing protocol.

@aajtodd
Copy link
Contributor

aajtodd commented Oct 17, 2016

Do you mean something like Wangle (and presumably finagle provide) where you can create re-usable parse/serialize layers?

I imagine something like this example from wangle: https://github.com/facebook/wangle/blob/master/wangle/example/echo/EchoServer.cpp#L39

Here the bottom of the "pipeline" starts with the socket layer that deals with pulling/pushing bytes on the wire. Then we move up into more specific codecs as we move along (e.g. Line->String->Echo). The interesting thing from their pipeline abstraction is the ability to define handlers that only deal with ingress, egress, or both.

I know more about wangle than finagle but I know that is where they also got their inspiration (and of course netty). The mapping to rust in tokio has been difficult to follow and I'm still really struggling to put all the pieces together. I'm assuming this kind of functionality is where tokio-proto fits in given some of the abstractions in this crate.

@Yamakaky
Copy link
Author

Yeah, that's it.

@carllerche
Copy link
Member

Thanks for the report.

This can already be done (though additional boiler plate)

The FramedIo trait in tokio_core provides the necessary building blocks to compose layers.

For example, you could have a FramedIo impl that does line based decoding and pass that to one that does string decoding.

This requires a bit more polish and a lot more documentation, so I will flag this as a doc issue.

@carllerche
Copy link
Member

FramedIo is gone. We've added docs at https://tokio.rs. Also, tokio-io is about to land, so I'm going to close this.

@farcaller
Copy link

farcaller commented Mar 7, 2017

Can you link the doc from tokio.rs to this issue, where it explains the FramedIo usage?

@carllerche
Copy link
Member

FramedIo has been removed from tokio since the original issue was posted.

@carllerche
Copy link
Member

In favor of Sink + Stream traits from futures-rs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants