Skip to content

Commit

Permalink
feat: support From<&[u8; N]> for Bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kermit committed Mar 25, 2024
1 parent ce8d8a0 commit df94375
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,12 @@ impl From<&'static [u8]> for Bytes {
}
}

impl<const N: usize> From<&[u8; N]> for Bytes {
fn from(slice: &[u8; N]) -> Self {
Bytes::copy_from_slice(slice)
}
}

impl From<&'static str> for Bytes {
fn from(slice: &'static str) -> Bytes {
Bytes::from_static(slice.as_bytes())
Expand Down

0 comments on commit df94375

Please sign in to comment.