pub struct HandlerFn<F, S> { /* private fields */ }Expand description
Wrapper for converting handler functions to the Handler trait
Implementations§
Trait Implementations§
Source§impl<F, Fut, Res, S> Handler<(), S> for HandlerFn<F, S>
Implementation for handlers with no extractors
impl<F, Fut, Res, S> Handler<(), S> for HandlerFn<F, S>
Implementation for handlers with no extractors
Source§type Future = Pin<Box<dyn Future<Output = Result<CoapResponse, Infallible>> + Send>>
type Future = Pin<Box<dyn Future<Output = Result<CoapResponse, Infallible>> + Send>>
The future returned by this handler
Source§fn call(
self,
_req: CoapumRequest<SocketAddr>,
_state: Arc<Mutex<S>>,
) -> Self::Future
fn call( self, _req: CoapumRequest<SocketAddr>, _state: Arc<Mutex<S>>, ) -> Self::Future
Call this handler with the given request and state
Source§impl<F, Fut, Res, T1, S> Handler<(T1,), S> for HandlerFn<F, S>
Implementation for handlers with one extractor
impl<F, Fut, Res, T1, S> Handler<(T1,), S> for HandlerFn<F, S>
Implementation for handlers with one extractor
Source§type Future = Pin<Box<dyn Future<Output = Result<CoapResponse, Infallible>> + Send>>
type Future = Pin<Box<dyn Future<Output = Result<CoapResponse, Infallible>> + Send>>
The future returned by this handler
Source§fn call(
self,
req: CoapumRequest<SocketAddr>,
state: Arc<Mutex<S>>,
) -> Self::Future
fn call( self, req: CoapumRequest<SocketAddr>, state: Arc<Mutex<S>>, ) -> Self::Future
Call this handler with the given request and state
Source§impl<F, Fut, Res, T1, T2, S> Handler<(T1, T2), S> for HandlerFn<F, S>where
F: Fn(T1, T2) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = Res> + Send + 'static,
Res: IntoResponse + Send + 'static,
T1: FromRequest<S> + Send + 'static,
T2: FromRequest<S> + Send + 'static,
T1::Rejection: Send + 'static,
T2::Rejection: Send + 'static,
S: Send + Sync + 'static,
Implementation for handlers with two extractors
impl<F, Fut, Res, T1, T2, S> Handler<(T1, T2), S> for HandlerFn<F, S>where
F: Fn(T1, T2) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = Res> + Send + 'static,
Res: IntoResponse + Send + 'static,
T1: FromRequest<S> + Send + 'static,
T2: FromRequest<S> + Send + 'static,
T1::Rejection: Send + 'static,
T2::Rejection: Send + 'static,
S: Send + Sync + 'static,
Implementation for handlers with two extractors
Source§type Future = Pin<Box<dyn Future<Output = Result<CoapResponse, Infallible>> + Send>>
type Future = Pin<Box<dyn Future<Output = Result<CoapResponse, Infallible>> + Send>>
The future returned by this handler
Source§fn call(
self,
req: CoapumRequest<SocketAddr>,
state: Arc<Mutex<S>>,
) -> Self::Future
fn call( self, req: CoapumRequest<SocketAddr>, state: Arc<Mutex<S>>, ) -> Self::Future
Call this handler with the given request and state
Source§impl<F, Fut, Res, T1, T2, T3, S> Handler<(T1, T2, T3), S> for HandlerFn<F, S>where
F: Fn(T1, T2, T3) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = Res> + Send + 'static,
Res: IntoResponse + Send + 'static,
T1: FromRequest<S> + Send + 'static,
T2: FromRequest<S> + Send + 'static,
T3: FromRequest<S> + Send + 'static,
T1::Rejection: Send + 'static,
T2::Rejection: Send + 'static,
T3::Rejection: Send + 'static,
S: Send + Sync + 'static,
Implementation for handlers with three extractors
impl<F, Fut, Res, T1, T2, T3, S> Handler<(T1, T2, T3), S> for HandlerFn<F, S>where
F: Fn(T1, T2, T3) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = Res> + Send + 'static,
Res: IntoResponse + Send + 'static,
T1: FromRequest<S> + Send + 'static,
T2: FromRequest<S> + Send + 'static,
T3: FromRequest<S> + Send + 'static,
T1::Rejection: Send + 'static,
T2::Rejection: Send + 'static,
T3::Rejection: Send + 'static,
S: Send + Sync + 'static,
Implementation for handlers with three extractors
Source§type Future = Pin<Box<dyn Future<Output = Result<CoapResponse, Infallible>> + Send>>
type Future = Pin<Box<dyn Future<Output = Result<CoapResponse, Infallible>> + Send>>
The future returned by this handler
Source§fn call(
self,
req: CoapumRequest<SocketAddr>,
state: Arc<Mutex<S>>,
) -> Self::Future
fn call( self, req: CoapumRequest<SocketAddr>, state: Arc<Mutex<S>>, ) -> Self::Future
Call this handler with the given request and state
Source§impl<F, Fut, Res, T1, T2, T3, T4, S> Handler<(T1, T2, T3, T4), S> for HandlerFn<F, S>where
F: Fn(T1, T2, T3, T4) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = Res> + Send + 'static,
Res: IntoResponse + Send + 'static,
T1: FromRequest<S> + Send + 'static,
T2: FromRequest<S> + Send + 'static,
T3: FromRequest<S> + Send + 'static,
T4: FromRequest<S> + Send + 'static,
T1::Rejection: Send + 'static,
T2::Rejection: Send + 'static,
T3::Rejection: Send + 'static,
T4::Rejection: Send + 'static,
S: Send + Sync + 'static,
Implementation for handlers with four extractors
impl<F, Fut, Res, T1, T2, T3, T4, S> Handler<(T1, T2, T3, T4), S> for HandlerFn<F, S>where
F: Fn(T1, T2, T3, T4) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = Res> + Send + 'static,
Res: IntoResponse + Send + 'static,
T1: FromRequest<S> + Send + 'static,
T2: FromRequest<S> + Send + 'static,
T3: FromRequest<S> + Send + 'static,
T4: FromRequest<S> + Send + 'static,
T1::Rejection: Send + 'static,
T2::Rejection: Send + 'static,
T3::Rejection: Send + 'static,
T4::Rejection: Send + 'static,
S: Send + Sync + 'static,
Implementation for handlers with four extractors
Source§type Future = Pin<Box<dyn Future<Output = Result<CoapResponse, Infallible>> + Send>>
type Future = Pin<Box<dyn Future<Output = Result<CoapResponse, Infallible>> + Send>>
The future returned by this handler
Source§fn call(
self,
req: CoapumRequest<SocketAddr>,
state: Arc<Mutex<S>>,
) -> Self::Future
fn call( self, req: CoapumRequest<SocketAddr>, state: Arc<Mutex<S>>, ) -> Self::Future
Call this handler with the given request and state
Auto Trait Implementations§
impl<F, S> Freeze for HandlerFn<F, S>where
F: Freeze,
impl<F, S> RefUnwindSafe for HandlerFn<F, S>where
F: RefUnwindSafe,
S: RefUnwindSafe,
impl<F, S> Send for HandlerFn<F, S>
impl<F, S> Sync for HandlerFn<F, S>
impl<F, S> Unpin for HandlerFn<F, S>
impl<F, S> UnwindSafe for HandlerFn<F, S>where
F: UnwindSafe,
S: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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