mirror of
https://github.com/fafhrd91/actix-net
synced 2025-01-18 23:21:50 +01:00
doc tweaks
This commit is contained in:
parent
e49fedbfe7
commit
3c6f586b89
@ -503,15 +503,13 @@ pub(super) fn bind_addr<S: ToSocketAddrs>(
|
|||||||
|
|
||||||
if success {
|
if success {
|
||||||
Ok(sockets)
|
Ok(sockets)
|
||||||
|
} else if let Some(err) = err.take() {
|
||||||
|
Err(err)
|
||||||
} else {
|
} else {
|
||||||
if let Some(err) = err.take() {
|
Err(io::Error::new(
|
||||||
Err(err)
|
io::ErrorKind::Other,
|
||||||
} else {
|
"Can not bind to socket address",
|
||||||
Err(io::Error::new(
|
))
|
||||||
io::ErrorKind::Other,
|
|
||||||
"Can not bind to socket address",
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ use super::{Service, ServiceFactory};
|
|||||||
/// Service for the `and_then` combinator, chaining a computation onto the end of another service
|
/// Service for the `and_then` combinator, chaining a computation onto the end of another service
|
||||||
/// which completes successfully.
|
/// which completes successfully.
|
||||||
///
|
///
|
||||||
/// This is created by the `Pipeline::and_then` method.
|
/// Created by the `.and_then()` combinator.
|
||||||
pub struct AndThenService<A, B, Req>(Rc<(A, B)>, PhantomData<Req>);
|
pub struct AndThenService<A, B, Req>(Rc<(A, B)>, PhantomData<Req>);
|
||||||
|
|
||||||
impl<A, B, Req> AndThenService<A, B, Req> {
|
impl<A, B, Req> AndThenService<A, B, Req> {
|
||||||
@ -116,7 +116,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `.and_then()` service factory combinator
|
/// Service factory created by the `.and_then()` combinator.
|
||||||
pub struct AndThenServiceFactory<A, B, Req>
|
pub struct AndThenServiceFactory<A, B, Req>
|
||||||
where
|
where
|
||||||
A: ServiceFactory<Req>,
|
A: ServiceFactory<Req>,
|
||||||
@ -326,16 +326,16 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A: Clone, B: Clone, Req> Clone for AndThenSendServiceFactory<A, B, Req>
|
impl<A, B, Req> Clone for AndThenSendServiceFactory<A, B, Req>
|
||||||
where
|
where
|
||||||
A: ServiceFactory<Req>,
|
A: ServiceFactory<Req> + Clone,
|
||||||
A::Config: Clone,
|
A::Config: Clone,
|
||||||
B: ServiceFactory<
|
B: ServiceFactory<
|
||||||
A::Response,
|
A::Response,
|
||||||
Config = A::Config,
|
Config = A::Config,
|
||||||
Error = A::Error,
|
Error = A::Error,
|
||||||
InitError = A::InitError,
|
InitError = A::InitError,
|
||||||
>,
|
> + Clone,
|
||||||
{
|
{
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -63,7 +63,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convert `Fn(Config, &Server) -> Future<Service>` fn to NewService\
|
/// Convert `Fn(Config, &Server) -> Future<Service>` fn to ServiceFactory.
|
||||||
struct ApplyConfigService<S1, Req, F, Cfg, Fut, S2, Err>
|
struct ApplyConfigService<S1, Req, F, Cfg, Fut, S2, Err>
|
||||||
where
|
where
|
||||||
S1: Service<Req>,
|
S1: Service<Req>,
|
||||||
|
@ -44,7 +44,7 @@ pub trait ServiceExt<Req>: Service<Req> {
|
|||||||
/// Call another service after call to this one has resolved successfully.
|
/// Call another service after call to this one has resolved successfully.
|
||||||
///
|
///
|
||||||
/// This function can be used to chain two services together and ensure that the second service
|
/// This function can be used to chain two services together and ensure that the second service
|
||||||
/// isn't called until call to the fist service have finished. Result of the call to the first
|
/// isn't called until call to the fist service has resolved. Result of the call to the first
|
||||||
/// service is used as an input parameter for the second service's call.
|
/// service is used as an input parameter for the second service's call.
|
||||||
///
|
///
|
||||||
/// Note that this function consumes the receiving service and returns a wrapped version of it.
|
/// Note that this function consumes the receiving service and returns a wrapped version of it.
|
||||||
|
@ -103,7 +103,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `MapNewService` new service combinator
|
/// `MapServiceFactory` new service combinator.
|
||||||
pub struct MapServiceFactory<A, F, Req, Res> {
|
pub struct MapServiceFactory<A, F, Req, Res> {
|
||||||
a: A,
|
a: A,
|
||||||
f: F,
|
f: F,
|
||||||
|
@ -238,8 +238,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Map this service's output to a different type, returning a new service
|
/// Map this service's output to a different type, returning a new service.
|
||||||
/// of the resulting type.
|
|
||||||
pub fn map<F, R>(self, f: F) -> PipelineFactory<MapServiceFactory<SF, F, Req, R>, Req>
|
pub fn map<F, R>(self, f: F) -> PipelineFactory<MapServiceFactory<SF, F, Req, R>, Req>
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
@ -251,7 +250,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Map this service's error to a different error, returning a new service.
|
/// Map this service's error to a different type, returning a new service.
|
||||||
pub fn map_err<F, E>(
|
pub fn map_err<F, E>(
|
||||||
self,
|
self,
|
||||||
f: F,
|
f: F,
|
||||||
@ -266,7 +265,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Map this factory's init error to a different error, returning a new service.
|
/// Map this factory's init error to a different type, returning a new service.
|
||||||
pub fn map_init_err<F, E>(self, f: F) -> PipelineFactory<MapInitErr<SF, F, Req, E>, Req>
|
pub fn map_init_err<F, E>(self, f: F) -> PipelineFactory<MapInitErr<SF, F, Req, E>, Req>
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user