From 3c6f586b892f9eaa5eb3c9cb05995c0596359be2 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Mon, 1 Nov 2021 02:19:20 +0000 Subject: [PATCH] doc tweaks --- actix-server/src/builder.rs | 14 ++++++-------- actix-service/src/and_then.rs | 18 +++++++++--------- actix-service/src/apply_cfg.rs | 2 +- actix-service/src/ext.rs | 2 +- actix-service/src/map.rs | 2 +- actix-service/src/pipeline.rs | 7 +++---- 6 files changed, 21 insertions(+), 24 deletions(-) diff --git a/actix-server/src/builder.rs b/actix-server/src/builder.rs index 6128898d..b1657d97 100644 --- a/actix-server/src/builder.rs +++ b/actix-server/src/builder.rs @@ -503,15 +503,13 @@ pub(super) fn bind_addr( if success { Ok(sockets) + } else if let Some(err) = err.take() { + Err(err) } else { - if let Some(err) = err.take() { - Err(err) - } else { - Err(io::Error::new( - io::ErrorKind::Other, - "Can not bind to socket address", - )) - } + Err(io::Error::new( + io::ErrorKind::Other, + "Can not bind to socket address", + )) } } diff --git a/actix-service/src/and_then.rs b/actix-service/src/and_then.rs index fdf219f0..6a5d3ace 100644 --- a/actix-service/src/and_then.rs +++ b/actix-service/src/and_then.rs @@ -14,7 +14,7 @@ use super::{Service, ServiceFactory}; /// Service for the `and_then` combinator, chaining a computation onto the end of another service /// which completes successfully. /// -/// This is created by the `Pipeline::and_then` method. +/// Created by the `.and_then()` combinator. pub struct AndThenService(Rc<(A, B)>, PhantomData); impl AndThenService { @@ -116,7 +116,7 @@ where } } -/// `.and_then()` service factory combinator +/// Service factory created by the `.and_then()` combinator. pub struct AndThenServiceFactory where A: ServiceFactory, @@ -326,16 +326,16 @@ where } } -impl Clone for AndThenSendServiceFactory +impl Clone for AndThenSendServiceFactory where - A: ServiceFactory, + A: ServiceFactory + Clone, A::Config: Clone, B: ServiceFactory< - A::Response, - Config = A::Config, - Error = A::Error, - InitError = A::InitError, - >, + A::Response, + Config = A::Config, + Error = A::Error, + InitError = A::InitError, + > + Clone, { fn clone(&self) -> Self { Self { diff --git a/actix-service/src/apply_cfg.rs b/actix-service/src/apply_cfg.rs index 25fc5fc2..8b75dfb2 100644 --- a/actix-service/src/apply_cfg.rs +++ b/actix-service/src/apply_cfg.rs @@ -63,7 +63,7 @@ where } } -/// Convert `Fn(Config, &Server) -> Future` fn to NewService\ +/// Convert `Fn(Config, &Server) -> Future` fn to ServiceFactory. struct ApplyConfigService where S1: Service, diff --git a/actix-service/src/ext.rs b/actix-service/src/ext.rs index 622b0f55..0f82dc1b 100644 --- a/actix-service/src/ext.rs +++ b/actix-service/src/ext.rs @@ -44,7 +44,7 @@ pub trait ServiceExt: Service { /// 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 - /// 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. /// /// Note that this function consumes the receiving service and returns a wrapped version of it. diff --git a/actix-service/src/map.rs b/actix-service/src/map.rs index 12fd4395..025d8ce5 100644 --- a/actix-service/src/map.rs +++ b/actix-service/src/map.rs @@ -103,7 +103,7 @@ where } } -/// `MapNewService` new service combinator +/// `MapServiceFactory` new service combinator. pub struct MapServiceFactory { a: A, f: F, diff --git a/actix-service/src/pipeline.rs b/actix-service/src/pipeline.rs index 2c71a74b..dd86be6e 100644 --- a/actix-service/src/pipeline.rs +++ b/actix-service/src/pipeline.rs @@ -238,8 +238,7 @@ where } } - /// Map this service's output to a different type, returning a new service - /// of the resulting type. + /// Map this service's output to a different type, returning a new service. pub fn map(self, f: F) -> PipelineFactory, Req> where 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( self, 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(self, f: F) -> PipelineFactory, Req> where Self: Sized,