add unsafe from_bytes_unchecked

This commit is contained in:
Nikolay Kim 2019-12-07 10:48:22 +06:00
parent 40fbbb9c32
commit 393cf1ab25
1 changed files with 5 additions and 0 deletions

View File

@ -30,6 +30,11 @@ impl ByteString {
pub fn from_static(src: &'static str) -> ByteString {
Self(Bytes::from_static(src.as_ref()))
}
/// Creates a new `ByteString` from a Bytes.
pub unsafe fn from_bytes_unchecked(src: Bytes) -> ByteString {
Self(src)
}
}
impl PartialEq<str> for ByteString {