mirror of
https://github.com/actix/actix-web.git
synced 2025-04-10 11:54:06 +00:00
Implement Body for Cow<'static, str>
This commit is contained in:
parent
f45db1f909
commit
a732988ca2
1 changed files with 10 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
|||
use std::borrow::Cow;
|
||||
use std::marker::PhantomData;
|
||||
use std::pin::Pin;
|
||||
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 {
|
||||
fn from(s: Bytes) -> Body {
|
||||
Body::Bytes(s)
|
||||
|
|
Loading…
Reference in a new issue