Skip to content

Commit 8ad5f58

Browse files
authored
Remove ServerBuilder::configure (#349)
1 parent 613b2be commit 8ad5f58

File tree

7 files changed

+13
-460
lines changed

7 files changed

+13
-460
lines changed

actix-server/CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Changes
22

33
## Unreleased - 2021-xx-xx
4+
* Remove `config` module. `ServiceConfig`, `ServiceRuntime` public types are removed due to this change. [#349]
5+
* Remove `ServerBuilder::configure` [#349]
6+
7+
[#349]: https://github.com/actix/actix-net/pull/349
48

59

610
## 2.0.0-beta.5 - 2021-04-20

actix-server/src/builder.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver};
1212
use tokio::sync::oneshot;
1313

1414
use crate::accept::AcceptLoop;
15-
use crate::config::{ConfiguredService, ServiceConfig};
1615
use crate::server::{Server, ServerCommand};
1716
use crate::service::{InternalServiceFactory, ServiceFactory, StreamNewService};
1817
use crate::signals::{Signal, Signals};
@@ -149,32 +148,6 @@ impl ServerBuilder {
149148
self
150149
}
151150

152-
/// Execute external configuration as part of the server building process.
153-
///
154-
/// This function is useful for moving parts of configuration to a different module or
155-
/// even library.
156-
pub fn configure<F>(mut self, f: F) -> io::Result<ServerBuilder>
157-
where
158-
F: Fn(&mut ServiceConfig) -> io::Result<()>,
159-
{
160-
let mut cfg = ServiceConfig::new(self.threads, self.backlog);
161-
162-
f(&mut cfg)?;
163-
164-
if let Some(apply) = cfg.apply {
165-
let mut srv = ConfiguredService::new(apply);
166-
for (name, lst) in cfg.services {
167-
let token = self.token.next();
168-
srv.stream(token, name.clone(), lst.local_addr()?);
169-
self.sockets.push((token, name, MioListener::Tcp(lst)));
170-
}
171-
self.services.push(Box::new(srv));
172-
}
173-
self.threads = cfg.threads;
174-
175-
Ok(self)
176-
}
177-
178151
/// Add new service to the server.
179152
pub fn bind<F, U, N: AsRef<str>>(mut self, name: N, addr: U, factory: F) -> io::Result<Self>
180153
where

actix-server/src/config.rs

Lines changed: 0 additions & 287 deletions
This file was deleted.

actix-server/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
mod accept;
88
mod builder;
9-
mod config;
109
mod server;
1110
mod service;
1211
mod signals;
@@ -16,7 +15,6 @@ mod waker_queue;
1615
mod worker;
1716

1817
pub use self::builder::ServerBuilder;
19-
pub use self::config::{ServiceConfig, ServiceRuntime};
2018
pub use self::server::Server;
2119
pub use self::service::ServiceFactory;
2220
pub use self::test_server::TestServer;

actix-server/src/service.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub(crate) trait InternalServiceFactory: Send {
2424

2525
fn clone_factory(&self) -> Box<dyn InternalServiceFactory>;
2626

27-
fn create(&self) -> LocalBoxFuture<'static, Result<Vec<(Token, BoxedServerService)>, ()>>;
27+
fn create(&self) -> LocalBoxFuture<'static, Result<(Token, BoxedServerService), ()>>;
2828
}
2929

3030
pub(crate) type BoxedServerService = Box<
@@ -131,14 +131,14 @@ where
131131
})
132132
}
133133

134-
fn create(&self) -> LocalBoxFuture<'static, Result<Vec<(Token, BoxedServerService)>, ()>> {
134+
fn create(&self) -> LocalBoxFuture<'static, Result<(Token, BoxedServerService), ()>> {
135135
let token = self.token;
136136
let fut = self.inner.create().new_service(());
137137
Box::pin(async move {
138138
match fut.await {
139139
Ok(inner) => {
140140
let service = Box::new(StreamService::new(inner)) as _;
141-
Ok(vec![(token, service)])
141+
Ok((token, service))
142142
}
143143
Err(_) => Err(()),
144144
}

0 commit comments

Comments
 (0)