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

codec: docs: fix length_delimited doc description and make examples testable #6638

Merged
merged 3 commits into from
Jun 23, 2024

Conversation

name1e5s
Copy link
Contributor

Motivation

According to comment in #6604, some examples for length_delimited do not fit the real behavior. This PR fix the document and add tests to the examples.

Close #6604

Solution

Fix the docs.

Swap the order of example 1 and 2 to make it more easier to understand.

@name1e5s name1e5s force-pushed the chore/length_delimited_docfix branch from 7f10313 to 50d98d6 Compare June 14, 2024 14:49
@mox692 mox692 added T-docs Topic: documentation A-tokio-util Area: The tokio-util crate M-codec Module: tokio-util/codec labels Jun 14, 2024
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a good improvement. A few nits:

tokio-util/src/codec/length_delimited.rs Outdated Show resolved Hide resolved
tokio-util/src/codec/length_delimited.rs Outdated Show resolved Hide resolved
Co-authored-by: Alice Ryhl <aliceryhl@google.com>
Copy link
Member

@mox692 mox692 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me!

@mox692 mox692 merged commit 0658277 into tokio-rs:master Jun 23, 2024
77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio-util Area: The tokio-util crate M-codec Module: tokio-util/codec T-docs Topic: documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LengthDelimitedCodec misses that last N bytes of the frame with num_skip(0)
3 participants