Struct ntex::service::dev::FnServiceFactory [−][src]
pub struct FnServiceFactory<F, Fut, Req, Res, Err, Cfg, FShut = fn()> where
F: Fn(Req) -> Fut,
Fut: Future<Output = Result<Res, Err>>, { /* fields omitted */ }
Implementations
pub fn on_shutdown<FShut>(
self,
f: FShut
) -> FnServiceFactory<F, Fut, Req, Res, Err, Cfg, FShut> where
FShut: FnOnce(),
pub fn on_shutdown<FShut>(
self,
f: FShut
) -> FnServiceFactory<F, Fut, Req, Res, Err, Cfg, FShut> where
FShut: FnOnce(),
Set function that get called oin poll_shutdown method of Service trait.
Trait Implementations
impl<F, Fut, Req, Res, Err, Cfg> IntoServiceFactory<FnServiceFactory<F, Fut, Req, Res, Err, Cfg, fn()>, Req, Cfg> for F where
F: Fn(Req) -> Fut + Clone,
Fut: Future<Output = Result<Res, Err>>,
impl<F, Fut, Req, Res, Err, Cfg> IntoServiceFactory<FnServiceFactory<F, Fut, Req, Res, Err, Cfg, fn()>, Req, Cfg> for F where
F: Fn(Req) -> Fut + Clone,
Fut: Future<Output = Result<Res, Err>>,
Convert Self
to a ServiceFactory
type Response = Res
type Response = Res
Responses given by the service.
type Error = Err
type Error = Err
Errors produced by the service.
type Future = Fut
type Future = Fut
The future response value.
pub fn poll_ready(
&self,
&mut Context<'_>
) -> Poll<Result<(), <FnServiceFactory<F, Fut, Req, Res, Err, (), FShut> as Service<Req>>::Error>>
pub fn poll_ready(
&self,
&mut Context<'_>
) -> Poll<Result<(), <FnServiceFactory<F, Fut, Req, Res, Err, (), FShut> as Service<Req>>::Error>>
Returns Ready
when the service is able to process requests. Read more
Process the request and return the response asynchronously. Read more
Map this service’s output to a different type, returning a new service of the resulting type. Read more
impl<F, Fut, Req, Res, Err, Cfg, FShut> ServiceFactory<Req, Cfg> for FnServiceFactory<F, Fut, Req, Res, Err, Cfg, FShut> where
F: Fn(Req) -> Fut + Clone,
FShut: FnOnce() + Clone,
Fut: Future<Output = Result<Res, Err>>,
impl<F, Fut, Req, Res, Err, Cfg, FShut> ServiceFactory<Req, Cfg> for FnServiceFactory<F, Fut, Req, Res, Err, Cfg, FShut> where
F: Fn(Req) -> Fut + Clone,
FShut: FnOnce() + Clone,
Fut: Future<Output = Result<Res, Err>>,
type Response = Res
type Response = Res
Responses given by the service
type Error = Err
type Error = Err
Errors produced by the service
type Future = Ready<<FnServiceFactory<F, Fut, Req, Res, Err, Cfg, FShut> as ServiceFactory<Req, Cfg>>::Service, <FnServiceFactory<F, Fut, Req, Res, Err, Cfg, FShut> as ServiceFactory<Req, Cfg>>::InitError>
type Future = Ready<<FnServiceFactory<F, Fut, Req, Res, Err, Cfg, FShut> as ServiceFactory<Req, Cfg>>::Service, <FnServiceFactory<F, Fut, Req, Res, Err, Cfg, FShut> as ServiceFactory<Req, Cfg>>::InitError>
The future of the ServiceFactory
instance.
pub fn new_service(
&self,
Cfg
) -> <FnServiceFactory<F, Fut, Req, Res, Err, Cfg, FShut> as ServiceFactory<Req, Cfg>>::Future
pub fn new_service(
&self,
Cfg
) -> <FnServiceFactory<F, Fut, Req, Res, Err, Cfg, FShut> as ServiceFactory<Req, Cfg>>::Future
Create and return a new service value asynchronously.
Map this service’s output to a different type, returning a new service of the resulting type. Read more
Map this service’s error to a different error, returning a new service.
fn map_init_err<F, E>(self, f: F) -> MapInitErr<Self, Req, Cfg, F, E> where
F: Fn(Self::InitError) -> E + Clone,
fn map_init_err<F, E>(self, f: F) -> MapInitErr<Self, Req, Cfg, F, E> where
F: Fn(Self::InitError) -> E + Clone,
Map this factory’s init error to a different error, returning a new service.
Auto Trait Implementations
impl<F, Fut, Req, Res, Err, Cfg, FShut = fn()> !RefUnwindSafe for FnServiceFactory<F, Fut, Req, Res, Err, Cfg, FShut>
impl<F, Fut, Req, Res, Err, Cfg, FShut> Send for FnServiceFactory<F, Fut, Req, Res, Err, Cfg, FShut> where
Cfg: Send,
F: Send,
FShut: Send,
Req: Send,
impl<F, Fut, Req, Res, Err, Cfg, FShut = fn()> !Sync for FnServiceFactory<F, Fut, Req, Res, Err, Cfg, FShut>
impl<F, Fut, Req, Res, Err, Cfg, FShut> Unpin for FnServiceFactory<F, Fut, Req, Res, Err, Cfg, FShut> where
Cfg: Unpin,
F: Unpin,
FShut: Unpin,
Req: Unpin,
impl<F, Fut, Req, Res, Err, Cfg, FShut> UnwindSafe for FnServiceFactory<F, Fut, Req, Res, Err, Cfg, FShut> where
Cfg: UnwindSafe,
F: UnwindSafe,
FShut: UnwindSafe,
Req: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Convert to a Service
Convert Self
to a ServiceFactory
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more