Skip to content

Commit

Permalink
fix: bytes from impl
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-j97 committed Jan 22, 2025
1 parent c0f2cae commit 82ab3f5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@ impl AsRef<[u8]> for Slice {

impl From<&[u8]> for Slice {
fn from(value: &[u8]) -> Self {
Self(value.into())
#[cfg(not(feature = "bytes"))]
{
Self(byteview::ByteView::new(value))
}

#[cfg(feature = "bytes")]
{
Self(bytes::Bytes::from(value.to_vec()))
}
}
}

Expand Down

0 comments on commit 82ab3f5

Please sign in to comment.