1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-27 23:42:56 +01:00

add unsafe from_bytes_unchecked

This commit is contained in:
Nikolay Kim 2019-12-07 10:48:22 +06:00
parent 40fbbb9c32
commit 393cf1ab25

View File

@ -30,6 +30,11 @@ impl ByteString {
pub fn from_static(src: &'static str) -> ByteString { pub fn from_static(src: &'static str) -> ByteString {
Self(Bytes::from_static(src.as_ref())) 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 { impl PartialEq<str> for ByteString {