diff --git a/examples/htmlx/src/main.rs b/examples/htmlx/src/main.rs
index 030a5c80..3dd61a45 100644
--- a/examples/htmlx/src/main.rs
+++ b/examples/htmlx/src/main.rs
@@ -52,7 +52,7 @@ async fn index(req: Request) -> Result {
"todos": todos
}),
)
- .map_err(Error::normal)?;
+ .map_err(Error::boxed)?;
Ok(Response::html(body))
}
@@ -70,7 +70,7 @@ async fn list(req: Request) -> Result {
"todos": todos
}),
)
- .map_err(Error::normal)?;
+ .map_err(Error::boxed)?;
Ok(Response::html(body))
}
diff --git a/examples/otel/metrics/src/main.rs b/examples/otel/metrics/src/main.rs
index 237ae5d6..97fe9b1e 100644
--- a/examples/otel/metrics/src/main.rs
+++ b/examples/otel/metrics/src/main.rs
@@ -32,7 +32,7 @@ async fn main() -> Result<()> {
ExporterBuilder::default()
.with_registry(registry.clone())
.build()
- .map_err(Error::normal)?,
+ .map_err(Error::boxed)?,
metrics::new_view(
Instrument::new().name("http.server.duration"),
Stream::new().aggregation(Aggregation::ExplicitBucketHistogram {
diff --git a/examples/routing/openapi/src/main.rs b/examples/routing/openapi/src/main.rs
index e91294e8..f5b8a2eb 100644
--- a/examples/routing/openapi/src/main.rs
+++ b/examples/routing/openapi/src/main.rs
@@ -284,7 +284,7 @@ async fn swagger_ui(req: Request) -> Result {
.map_err(|err| (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()).into_error())?
{
Some(file) => Ok({
- let content_type = HeaderValue::from_str(&file.content_type).map_err(Error::normal)?;
+ let content_type = HeaderValue::from_str(&file.content_type).map_err(Error::boxed)?;
let mut resp = Response::new(Full::from(file.bytes).into());
resp.headers_mut()
diff --git a/examples/sse/src/main.rs b/examples/sse/src/main.rs
index 937f4379..5eeb2984 100644
--- a/examples/sse/src/main.rs
+++ b/examples/sse/src/main.rs
@@ -39,8 +39,8 @@ async fn stats(req: Request) -> Result {
IntervalStream::new(interval(Duration::from_secs(10))).map(move |_| {
match sys
.load_average()
- .map_err(Error::normal)
- .and_then(|loadavg| serde_json::to_string(&loadavg).map_err(Error::normal))
+ .map_err(Error::boxed)
+ .and_then(|loadavg| serde_json::to_string(&loadavg).map_err(Error::boxed))
{
Ok(loadavg) => Event::default().data(loadavg),
Err(err) => {
diff --git a/examples/templates/askama/src/main.rs b/examples/templates/askama/src/main.rs
index 99c79c7f..63cf62d8 100644
--- a/examples/templates/askama/src/main.rs
+++ b/examples/templates/askama/src/main.rs
@@ -18,7 +18,7 @@ async fn index(_: Request) -> Result {
buf.extend(
HelloTemplate { name: "world" }
.render()
- .map_err(Error::normal)?
+ .map_err(Error::boxed)?
.as_bytes(),
);
diff --git a/examples/templates/minijinja/src/main.rs b/examples/templates/minijinja/src/main.rs
index feebd751..65d9467b 100644
--- a/examples/templates/minijinja/src/main.rs
+++ b/examples/templates/minijinja/src/main.rs
@@ -26,7 +26,7 @@ async fn index(_: Request) -> Result {
let mut buf = BytesMut::with_capacity(512);
buf.extend(
TPLS.get_template("index.html")
- .map_err(Error::normal)?
+ .map_err(Error::boxed)?
.render(context! {
title => "Viz.rs",
users => &vec![
@@ -40,7 +40,7 @@ async fn index(_: Request) -> Result {
},
],
})
- .map_err(Error::normal)?
+ .map_err(Error::boxed)?
.as_bytes(),
);
diff --git a/examples/templates/tera/src/main.rs b/examples/templates/tera/src/main.rs
index 1ec3438e..dc74c56c 100644
--- a/examples/templates/tera/src/main.rs
+++ b/examples/templates/tera/src/main.rs
@@ -37,7 +37,7 @@ async fn index(_: Request) -> Result {
let mut buf = BytesMut::with_capacity(512);
buf.extend(
TPLS.render("index.html", &ctx)
- .map_err(Error::normal)?
+ .map_err(Error::boxed)?
.as_bytes(),
);
diff --git a/viz-core/src/body.rs b/viz-core/src/body.rs
index df2103ed..4a4984e9 100644
--- a/viz-core/src/body.rs
+++ b/viz-core/src/body.rs
@@ -53,8 +53,8 @@ impl Body for IncomingBody {
Self::Empty => Poll::Ready(None),
Self::Incoming(i) => match i {
None => Poll::Ready(None),
- Some(b) => match Pin::new(b).poll_frame(cx)? {
- Poll::Ready(Some(f)) => Poll::Ready(Some(Ok(f))),
+ Some(inner) => match Pin::new(inner).poll_frame(cx)? {
+ Poll::Ready(Some(frame)) => Poll::Ready(Some(Ok(frame))),
Poll::Ready(None) => {
// the body has been used.
*i = None;
@@ -66,6 +66,7 @@ impl Body for IncomingBody {
}
}
+ #[inline]
fn is_end_stream(&self) -> bool {
match self {
Self::Empty | Self::Incoming(None) => true,
@@ -73,6 +74,7 @@ impl Body for IncomingBody {
}
}
+ #[inline]
fn size_hint(&self) -> SizeHint {
match self {
Self::Empty | Self::Incoming(None) => SizeHint::with_exact(0),
@@ -84,11 +86,12 @@ impl Body for IncomingBody {
impl Stream for IncomingBody {
type Item = Result>;
+ #[inline]
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll