1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-27 17:52:56 +01:00

more body conversion impls

This commit is contained in:
Nikolay Kim 2017-10-23 23:44:03 -07:00
parent 4ee2a60d88
commit 1aac83ac96
2 changed files with 13 additions and 1 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "actix-web"
version = "0.1.0"
version = "0.2.0"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Actix web framework"
readme = "README.md"

View File

@ -113,12 +113,24 @@ impl From<Rc<Bytes>> for BinaryBody {
}
}
impl<'a> From<&'a Rc<Bytes>> for BinaryBody {
fn from(body: &'a Rc<Bytes>) -> BinaryBody {
BinaryBody::SharedBytes(Rc::clone(body))
}
}
impl From<Arc<Bytes>> for BinaryBody {
fn from(body: Arc<Bytes>) -> BinaryBody {
BinaryBody::ArcSharedBytes(body)
}
}
impl<'a> From<&'a Arc<Bytes>> for BinaryBody {
fn from(body: &'a Arc<Bytes>) -> BinaryBody {
BinaryBody::ArcSharedBytes(Arc::clone(body))
}
}
impl AsRef<[u8]> for BinaryBody {
fn as_ref(&self) -> &[u8] {
match self {