diff --git a/src/body.rs b/src/body.rs index 1a99792..474977d 100644 --- a/src/body.rs +++ b/src/body.rs @@ -15,16 +15,16 @@ use super::SerdeValue; /// The different kinds of bodies to send. /// /// *Internal API* -pub(crate) enum Payload { +pub(crate) enum Payload<'a> { Empty, Text(String, String), #[cfg(feature = "json")] JSON(SerdeValue), - Reader(Box), + Reader(Box), Bytes(Vec), } -impl fmt::Debug for Payload { +impl fmt::Debug for Payload<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Payload::Empty => write!(f, "Empty"), @@ -37,8 +37,8 @@ impl fmt::Debug for Payload { } } -impl Default for Payload { - fn default() -> Payload { +impl Default for Payload<'_> { + fn default() -> Self { Payload::Empty } } @@ -56,25 +56,25 @@ pub(crate) enum BodySize { /// Payloads are turned into this type where we can hold both a size and the reader. /// /// *Internal API* -pub(crate) struct SizedReader { +pub(crate) struct SizedReader<'a> { pub size: BodySize, - pub reader: Box, + pub reader: Box, } -impl fmt::Debug for SizedReader { +impl fmt::Debug for SizedReader<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "SizedReader[size={:?},reader]", self.size) } } -impl SizedReader { - fn new(size: BodySize, reader: Box) -> Self { +impl<'a> SizedReader<'a> { + fn new(size: BodySize, reader: Box) -> Self { SizedReader { size, reader } } } -impl Payload { - pub fn into_read(self) -> SizedReader { +impl<'a> Payload<'a> { + pub fn into_read(self) -> SizedReader<'a> { match self { Payload::Empty => SizedReader::new(BodySize::Empty, Box::new(empty())), Payload::Text(text, _charset) => { diff --git a/src/request.rs b/src/request.rs index 7d469fb..152687e 100644 --- a/src/request.rs +++ b/src/request.rs @@ -227,7 +227,7 @@ impl Request { /// .set("Content-Type", "text/plain") /// .send(read); /// ``` - pub fn send(&mut self, reader: impl Read + 'static) -> Response { + pub fn send(&mut self, reader: impl Read) -> Response { self.do_call(Payload::Reader(Box::new(reader))) }