pub struct FnHttpServiceFactory<F>(/* private fields */);
Expand description
A HttpServiceFactory
that creates a FnHttpService
from a function.
The given function will be called for each new connection.
This is useful for creating simple factories without needing to implement the HttpServiceFactory
trait.
Create by calling fn_http_service_factory
.
Trait Implementations§
Source§impl<F: Clone> Clone for FnHttpServiceFactory<F>
impl<F: Clone> Clone for FnHttpServiceFactory<F>
Source§fn clone(&self) -> FnHttpServiceFactory<F>
fn clone(&self) -> FnHttpServiceFactory<F>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<F> Debug for FnHttpServiceFactory<F>
impl<F> Debug for FnHttpServiceFactory<F>
Source§impl<F, Fut, E, S> HttpServiceFactory for FnHttpServiceFactory<F>where
F: Fn(SocketAddr) -> Fut,
Fut: Future<Output = Result<S, E>> + Send,
E: Error,
S: HttpService,
impl<F, Fut, E, S> HttpServiceFactory for FnHttpServiceFactory<F>where
F: Fn(SocketAddr) -> Fut,
Fut: Future<Output = Result<S, E>> + Send,
E: Error,
S: HttpService,
Source§type Error = E
type Error = E
The error type that can be returned by
new_service
.Source§fn new_service(
&mut self,
remote_addr: SocketAddr,
) -> impl Future<Output = Result<Self::Service, Self::Error>> + Send
fn new_service( &mut self, remote_addr: SocketAddr, ) -> impl Future<Output = Result<Self::Service, Self::Error>> + Send
Create a new service for a new connection. Read more
Auto Trait Implementations§
impl<F> Freeze for FnHttpServiceFactory<F>where
F: Freeze,
impl<F> RefUnwindSafe for FnHttpServiceFactory<F>where
F: RefUnwindSafe,
impl<F> Send for FnHttpServiceFactory<F>where
F: Send,
impl<F> Sync for FnHttpServiceFactory<F>where
F: Sync,
impl<F> Unpin for FnHttpServiceFactory<F>where
F: Unpin,
impl<F> UnwindSafe for FnHttpServiceFactory<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