Add more conversion impls

This commit is contained in:
Carl Lerche
2016-11-02 22:27:00 -07:00
parent a367a723d8
commit 4886b44516
2 changed files with 20 additions and 1 deletions
+6
View File
@@ -166,6 +166,12 @@ impl ops::Deref for Bytes {
}
}
impl From<BytesMut> for Bytes {
fn from(src: BytesMut) -> Bytes {
src.freeze()
}
}
impl From<Vec<u8>> for Bytes {
fn from(src: Vec<u8>) -> Bytes {
BytesMut::from(src).freeze()