1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-26 19:47:43 +02:00

Use associated type for NewService config

This commit is contained in:
Nikolay Kim
2019-05-12 06:03:50 -07:00
parent 76c317e0b2
commit f0776fca94
46 changed files with 810 additions and 1010 deletions

View File

@ -4,7 +4,7 @@ use std::{net, thread, time};
use actix_codec::{BytesCodec, Framed};
use actix_server::{Io, Server, ServerConfig};
use actix_service::{fn_cfg_factory, fn_service, IntoService};
use actix_service::{new_service_cfg, service_fn, IntoService};
use bytes::Bytes;
use futures::{Future, Sink};
use net2::TcpBuilder;
@ -28,7 +28,7 @@ fn test_bind() {
let sys = actix_rt::System::new("test");
let srv = Server::build()
.bind("test", addr, move || {
fn_cfg_factory(move |cfg: &ServerConfig| {
new_service_cfg(move |cfg: &ServerConfig| {
assert_eq!(cfg.local_addr(), addr);
Ok::<_, ()>((|_| Ok::<_, ()>(())).into_service())
})
@ -54,7 +54,7 @@ fn test_bind_no_config() {
let h = thread::spawn(move || {
let sys = actix_rt::System::new("test");
let srv = Server::build()
.bind("test", addr, move || fn_service(|_| Ok::<_, ()>(())))
.bind("test", addr, move || service_fn(|_| Ok::<_, ()>(())))
.unwrap()
.start();
let _ = tx.send((srv, actix_rt::System::current()));
@ -76,7 +76,7 @@ fn test_listen() {
let lst = net::TcpListener::bind(addr).unwrap();
let srv = Server::build()
.listen("test", lst, move || {
fn_cfg_factory(move |cfg: &ServerConfig| {
new_service_cfg(move |cfg: &ServerConfig| {
assert_eq!(cfg.local_addr(), addr);
Ok::<_, ()>((|_| Ok::<_, ()>(())).into_service())
})
@ -105,7 +105,7 @@ fn test_start() {
let srv = Server::build()
.backlog(100)
.bind("test", addr, move || {
fn_cfg_factory(move |cfg: &ServerConfig| {
new_service_cfg(move |cfg: &ServerConfig| {
assert_eq!(cfg.local_addr(), addr);
Ok::<_, ()>(
(|io: Io<TcpStream>| {