Skip to content

Commit

Permalink
v0.1.10: fix for bytequeue and http_1
Browse files Browse the repository at this point in the history
  • Loading branch information
TimLuq committed Oct 29, 2024
1 parent 0ec97a6 commit 81208b9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bytedata"
version = "0.1.9"
version = "0.1.10"
edition = "2021"
rust-version = "1.75"
description = "Representation of a byte slice that is either static, borrowed, or shared."
Expand Down
8 changes: 8 additions & 0 deletions src/byte_chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ impl ByteChunk {
pub const LEN: usize = 14;

/// Create a `ByteChunk` from a slice.
///
/// # Panics
///
/// Panics if the slice is larger than [`ByteChunk::LEN`].
#[inline]
#[must_use]
pub const fn from_slice(data: &[u8]) -> Self {
Expand All @@ -34,6 +38,10 @@ impl ByteChunk {
}

/// Create a `ByteChunk` from a fixed-size array.
///
/// # Panics
///
/// Panics if the array is larger than [`ByteChunk::LEN`].
#[inline]
#[must_use]
pub const fn from_array<const L: usize>(data: &[u8; L]) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion src/http_body_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl<'a> http_body::Body for crate::ByteQueue<'a> {
let Some(mut aa) = this.pop_front() else {
return Poll::Ready(None);
};
if this.len() > 0xFFFF {
if aa.len() > 0xFFFF {
this.push_front(aa.sliced(0xFFFF..));
aa.make_sliced(0..0xFFFF);
}
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,10 @@ impl<'a> StrSliceResult<'a> {
}

/// Returns the sliced `str` if the slice was valid. Otherwise panics.
///
/// # Panics
///
/// Will panic if the slice was [`StrSliceResult::OutOfBounds`] or would result in [`StrSliceResult::InvalidUtf8`].
#[must_use]
#[inline]
pub const fn unwrap(self) -> &'a str {
Expand Down

0 comments on commit 81208b9

Please sign in to comment.