From 1aac83ac966e5a0993a530377b53a374d022de88 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 23 Oct 2017 23:44:03 -0700 Subject: [PATCH] more body conversion impls --- Cargo.toml | 2 +- src/body.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 72209adc..e7be744e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-web" -version = "0.1.0" +version = "0.2.0" authors = ["Nikolay Kim "] description = "Actix web framework" readme = "README.md" diff --git a/src/body.rs b/src/body.rs index adfb533a..c4ce4a08 100644 --- a/src/body.rs +++ b/src/body.rs @@ -113,12 +113,24 @@ impl From> for BinaryBody { } } +impl<'a> From<&'a Rc> for BinaryBody { + fn from(body: &'a Rc) -> BinaryBody { + BinaryBody::SharedBytes(Rc::clone(body)) + } +} + impl From> for BinaryBody { fn from(body: Arc) -> BinaryBody { BinaryBody::ArcSharedBytes(body) } } +impl<'a> From<&'a Arc> for BinaryBody { + fn from(body: &'a Arc) -> BinaryBody { + BinaryBody::ArcSharedBytes(Arc::clone(body)) + } +} + impl AsRef<[u8]> for BinaryBody { fn as_ref(&self) -> &[u8] { match self {