Skip to content

Add fallible Bytes slicing - #845

Open
malezjaa wants to merge 1 commit into
tokio-rs:masterfrom
malezjaa:master
Open

Add fallible Bytes slicing#845
malezjaa wants to merge 1 commit into
tokio-rs:masterfrom
malezjaa:master

Conversation

@malezjaa

Copy link
Copy Markdown

Closes #807

Add Bytes::try_slice as a non-panicking counterpart to Bytes::slice.
Return None for invalid, reversed, or overflowing ranges. Valid ranges retain the existing zero-copy behavior.

Return None for invalid range bounds while preserving the existing
zero-copy slicing behavior for valid ranges.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Bytes::try_slice method

1 participant