mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-28 00:00:20 +02:00
Fix
This commit is contained in:
@@ -122,7 +122,7 @@ macro_rules! impl_handler_call_with {
|
|||||||
Fut: Future + Send + 'static,
|
Fut: Future + Send + 'static,
|
||||||
Fut::Output: IntoResponse,
|
Fut::Output: IntoResponse,
|
||||||
{
|
{
|
||||||
// this puts `futures_util` in our public API but thats fine in axum-extra
|
// this puts `futures_util` in our public API but that's fine in axum-extra
|
||||||
type Future = Map<Fut, fn(Fut::Output) -> Response>;
|
type Future = Map<Fut, fn(Fut::Output) -> Response>;
|
||||||
|
|
||||||
fn call(
|
fn call(
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ where
|
|||||||
Rt: Send + 'static,
|
Rt: Send + 'static,
|
||||||
Lt: Send + 'static,
|
Lt: Send + 'static,
|
||||||
{
|
{
|
||||||
// this puts `futures_util` in our public API but thats fine in axum-extra
|
// this puts `futures_util` in our public API but that's fine in axum-extra
|
||||||
type Future = EitherFuture<
|
type Future = EitherFuture<
|
||||||
Map<L::Future, fn(<L::Future as Future>::Output) -> Response>,
|
Map<L::Future, fn(<L::Future as Future>::Output) -> Response>,
|
||||||
Map<R::Future, fn(<R::Future as Future>::Output) -> Response>,
|
Map<R::Future, fn(<R::Future as Future>::Output) -> Response>,
|
||||||
@@ -62,7 +62,7 @@ where
|
|||||||
Rt::Rejection: Send,
|
Rt::Rejection: Send,
|
||||||
S: Send + Sync + 'static,
|
S: Send + Sync + 'static,
|
||||||
{
|
{
|
||||||
// this puts `futures_util` in our public API but thats fine in axum-extra
|
// this puts `futures_util` in our public API but that's fine in axum-extra
|
||||||
type Future = BoxFuture<'static, Response>;
|
type Future = BoxFuture<'static, Response>;
|
||||||
|
|
||||||
fn call(self, req: Request, state: S) -> Self::Future {
|
fn call(self, req: Request, state: S) -> Self::Future {
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ more flexibility and allows us to change internal implementations without
|
|||||||
breaking the public API.
|
breaking the public API.
|
||||||
|
|
||||||
For example that means while [`Json`] is implemented using [`serde_json`] it
|
For example that means while [`Json`] is implemented using [`serde_json`] it
|
||||||
doesn't directly expose the [`serde_json::Error`] thats contained in
|
doesn't directly expose the [`serde_json::Error`] that's contained in
|
||||||
[`JsonRejection::JsonDataError`]. However it is still possible to access via
|
[`JsonRejection::JsonDataError`]. However it is still possible to access via
|
||||||
methods from [`std::error::Error`]:
|
methods from [`std::error::Error`]:
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ use super::rejection::NestedPathRejection;
|
|||||||
/// let api = Router::new().route(
|
/// let api = Router::new().route(
|
||||||
/// "/users",
|
/// "/users",
|
||||||
/// get(|path: NestedPath| async move {
|
/// get(|path: NestedPath| async move {
|
||||||
/// // `path` will be "/api" because thats what this
|
/// // `path` will be "/api" because that's what this
|
||||||
/// // router is nested at when we build `app`
|
/// // router is nested at when we build `app`
|
||||||
/// let path = path.as_str();
|
/// let path = path.as_str();
|
||||||
/// })
|
/// })
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ async fn main() {
|
|||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
.fallback_service(ServeDir::new(assets_dir).append_index_html_on_directories(true))
|
.fallback_service(ServeDir::new(assets_dir).append_index_html_on_directories(true))
|
||||||
.route("/ws", any(ws_handler))
|
.route("/ws", any(ws_handler))
|
||||||
// logging so we can see whats going on
|
// logging so we can see what's going on
|
||||||
.layer(
|
.layer(
|
||||||
TraceLayer::new_for_http()
|
TraceLayer::new_for_http()
|
||||||
.make_span_with(DefaultMakeSpan::default().include_headers(true)),
|
.make_span_with(DefaultMakeSpan::default().include_headers(true)),
|
||||||
|
|||||||
Reference in New Issue
Block a user