Codecs documentation could use some fully formed examples #6299
Labels
A-tokio-util
Area: The tokio-util crate
C-bug
Category: This is a bug.
E-help-wanted
Call for participation: Help is requested to fix this issue.
M-codec
Module: tokio-util/codec
T-docs
Topic: documentation
I've been trying to understand codecs and how to use them. I started at https://docs.rs/tokio-util/latest/tokio_util/codec/index.html, which got me thinking that what I need is either a
LinesCodec
orLengthDelimitedCodec
(I'm just playing around so doesn't really matter which one) and aFramedRead
to use it with a stream. I followed through to https://docs.rs/tokio-util/latest/tokio_util/codec/length_delimited/index.html which shows me how to configure a decoder, and https://docs.rs/tokio-util/latest/tokio_util/codec/struct.FramedRead.html which tells me whatFramedRead
has.But I still haven't really seen any concrete example that ties everything together and shows me exactly how to read a frame from a stream. I'm gathering that I actually need
tokio_stream::StreamExt
so I can do.next()
on my FramedRead. This does not seem to be explained anywhere in the docs I've seen so far, and I only figured it out by looking at https://users.rust-lang.org/t/understanding-framed-in-tokio/42449/2The documentation, by itself, does not help a beginner to get to a working state.
The text was updated successfully, but these errors were encountered: