Struct summer_boot::utils::util::Before
source · pub struct Before<F>(pub F);Expand description
定义对传入请求进行操作的中间件。
用于定义内联中间件的闭包。
Examples
use summer_boot::utils::util;
use summer_boot::Request;
use std::time::Instant;
let mut app = summer_boot::new();
app.with(util::Before(|mut request: Request<()>| async move {
request.set_ext(Instant::now());
request
}));Tuple Fields§
§0: FTrait Implementations§
source§impl<State, F, Fut> Middleware<State> for Before<F>
impl<State, F, Fut> Middleware<State> for Before<F>
Auto Trait Implementations§
impl<F> RefUnwindSafe for Before<F>where
F: RefUnwindSafe,
impl<F> Send for Before<F>where
F: Send,
impl<F> Sync for Before<F>where
F: Sync,
impl<F> Unpin for Before<F>where
F: Unpin,
impl<F> UnwindSafe for Before<F>where
F: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more