mirror of https://github.com/fafhrd91/actix-web
Implement Body for Cow<'static, str>
This commit is contained in:
parent
f45db1f909
commit
a732988ca2
|
@ -1,3 +1,4 @@
|
||||||
|
use std::borrow::Cow;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
|
@ -233,6 +234,15 @@ impl<'a> From<&'a String> for Body {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<Cow<'static, str>> for Body {
|
||||||
|
fn from(s: Cow<'static, str>) -> Body {
|
||||||
|
match s {
|
||||||
|
Cow::Borrowed(s) => Body::from(s),
|
||||||
|
Cow::Owned(s) => Body::from(s),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<Bytes> for Body {
|
impl From<Bytes> for Body {
|
||||||
fn from(s: Bytes) -> Body {
|
fn from(s: Bytes) -> Body {
|
||||||
Body::Bytes(s)
|
Body::Bytes(s)
|
||||||
|
|
Loading…
Reference in New Issue