Clean up RequestParts API (#167)

In http-body 0.4.3 `BoxBody` implements `Default`. This allows us to
clean up the API of `RequestParts` quite a bit.
This commit is contained in:
David Pedersen
2021-08-08 19:48:30 +02:00
committed by GitHub
parent bc27b09f5c
commit 6b218c7150
8 changed files with 112 additions and 38 deletions
+10
View File
@@ -13,6 +13,16 @@ impl Error {
inner: error.into(),
}
}
pub(crate) fn downcast<T>(self) -> Result<T, Self>
where
T: StdError + 'static,
{
match self.inner.downcast::<T>() {
Ok(t) => Ok(*t),
Err(err) => Err(*err.downcast().unwrap()),
}
}
}
impl fmt::Display for Error {