mirror of
https://github.com/robertwayne/axum-htmx
synced 2024-11-29 22:54:32 +01:00
Hidden ResponseFuture type
This commit is contained in:
parent
140a74c071
commit
d7a8ee55b1
1 changed files with 31 additions and 27 deletions
14
src/guard.rs
14
src/guard.rs
|
@ -63,7 +63,7 @@ where
|
||||||
{
|
{
|
||||||
type Response = S::Response;
|
type Response = S::Response;
|
||||||
type Error = S::Error;
|
type Error = S::Error;
|
||||||
type Future = ResponseFuture<'a, S::Future>;
|
type Future = private::ResponseFuture<'a, S::Future>;
|
||||||
|
|
||||||
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
self.inner.poll_ready(cx)
|
self.inner.poll_ready(cx)
|
||||||
|
@ -77,7 +77,7 @@ where
|
||||||
|
|
||||||
let response_future = self.inner.call(req);
|
let response_future = self.inner.call(req);
|
||||||
|
|
||||||
ResponseFuture {
|
private::ResponseFuture {
|
||||||
response_future,
|
response_future,
|
||||||
hx_request: self.hx_request,
|
hx_request: self.hx_request,
|
||||||
layer: self.layer.clone(),
|
layer: self.layer.clone(),
|
||||||
|
@ -85,12 +85,15 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod private {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
pub struct ResponseFuture<'a, F> {
|
pub struct ResponseFuture<'a, F> {
|
||||||
#[pin]
|
#[pin]
|
||||||
response_future: F,
|
pub(super) response_future: F,
|
||||||
hx_request: bool,
|
pub(super) hx_request: bool,
|
||||||
layer: HxRequestGuardLayer<'a>,
|
pub(super) layer: HxRequestGuardLayer<'a>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,6 +122,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
struct HxRequestGuardError;
|
struct HxRequestGuardError;
|
||||||
|
|
Loading…
Reference in a new issue