Skip to content

Commit

Permalink
make &'static str ByteOwner
Browse files Browse the repository at this point in the history
  • Loading branch information
somethingelseentirely committed Oct 21, 2024
1 parent d16d62f commit b3ab42c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,6 @@ impl<T: ByteOwner> From<Arc<T>> for Bytes {
}
}

impl From<&'static str> for Bytes {
fn from(value: &'static str) -> Self {
Self::from_owner(value.as_bytes())
}
}

impl AsRef<[u8]> for Bytes {
#[inline]
fn as_ref(&self) -> &[u8] {
Expand Down
6 changes: 6 additions & 0 deletions src/owners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ unsafe impl ByteOwner for String {
}
}

unsafe impl ByteOwner for &'static str {
fn as_bytes(&self) -> &[u8] {
(*self).as_bytes()
}
}

#[cfg(feature = "bytes")]
unsafe impl ByteOwner for bytes::Bytes {
fn as_bytes(&self) -> &[u8] {
Expand Down

0 comments on commit b3ab42c

Please sign in to comment.