Merge pull request #203 from kamalmarhubi/master
async: Add conversions from static slices to Body
This commit is contained in:
@@ -51,6 +51,13 @@ impl From<Vec<u8>> for Body {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&'static [u8]> for Body {
|
||||
#[inline]
|
||||
fn from(s: &'static [u8]) -> Body {
|
||||
reusable(Bytes::from_static(s))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<String> for Body {
|
||||
#[inline]
|
||||
fn from(s: String) -> Body {
|
||||
@@ -58,6 +65,13 @@ impl From<String> for Body {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&'static str> for Body {
|
||||
#[inline]
|
||||
fn from(s: &'static str) -> Body {
|
||||
s.as_bytes().into()
|
||||
}
|
||||
}
|
||||
|
||||
/// A chunk of bytes for a `Body`.
|
||||
///
|
||||
/// A `Chunk` can be treated like `&[u8]`.
|
||||
|
||||
Reference in New Issue
Block a user