mirror of https://github.com/fafhrd91/actix-net
impl default for tcp connector service
This commit is contained in:
parent
e530225520
commit
c8c7358a08
|
@ -10,12 +10,14 @@
|
||||||
* Implement `Error` for `accept::TlsError` where both types also implement `Error`. [#422]
|
* Implement `Error` for `accept::TlsError` where both types also implement `Error`. [#422]
|
||||||
* Implement `Default` for `connect::Resolver`. [#422]
|
* Implement `Default` for `connect::Resolver`. [#422]
|
||||||
* Implement `Error` for `connect::ConnectError`. [#422]
|
* Implement `Error` for `connect::ConnectError`. [#422]
|
||||||
|
* Implement `Default` for `tcp::{TcpConnector, TcpConnectorService}`. [#423]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* The crate's default features flags no longer include `uri`. [#422]
|
* The crate's default features flags no longer include `uri`. [#422]
|
||||||
* Useful re-exports from underlying TLS crates are exposed in a `reexports` modules in all acceptors and connectors.
|
* Useful re-exports from underlying TLS crates are exposed in a `reexports` modules in all acceptors and connectors.
|
||||||
* Convert `connect::ResolverService` from enum to struct. [#422]
|
* Convert `connect::ResolverService` from enum to struct. [#422]
|
||||||
* Make `ConnectAddrsIter` private. [#422]
|
* Make `ConnectAddrsIter` private. [#422]
|
||||||
|
* Mark `tcp::{TcpConnector, TcpConnectorService}` structs `#[non_exhaustive]`. [#423]
|
||||||
* Rename `accept::native_tls::{NativeTlsAcceptorService => AcceptorService}`. [#422]
|
* Rename `accept::native_tls::{NativeTlsAcceptorService => AcceptorService}`. [#422]
|
||||||
* Rename `connect::{Address => Host}` trait. [#422]
|
* Rename `connect::{Address => Host}` trait. [#422]
|
||||||
* Rename method `connect::Connection::{host => hostname}`. [#422]
|
* Rename method `connect::Connection::{host => hostname}`. [#422]
|
||||||
|
@ -32,6 +34,7 @@
|
||||||
* Remove redundant `connect::Connection::from_parts` method. [#422]
|
* Remove redundant `connect::Connection::from_parts` method. [#422]
|
||||||
|
|
||||||
[#422]: https://github.com/actix/actix-net/pull/422
|
[#422]: https://github.com/actix/actix-net/pull/422
|
||||||
|
[#423]: https://github.com/actix/actix-net/pull/423
|
||||||
|
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl Connector {
|
||||||
/// Build connector service.
|
/// Build connector service.
|
||||||
pub fn service(&self) -> ConnectorService {
|
pub fn service(&self) -> ConnectorService {
|
||||||
ConnectorService {
|
ConnectorService {
|
||||||
tcp: TcpConnector.service(),
|
tcp: TcpConnector::default().service(),
|
||||||
resolver: self.resolver.service(),
|
resolver: self.resolver.service(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,13 +21,14 @@ use tokio_util::sync::ReusableBoxFuture;
|
||||||
use super::{connect_addrs::ConnectAddrs, error::ConnectError, ConnectInfo, Connection, Host};
|
use super::{connect_addrs::ConnectAddrs, error::ConnectError, ConnectInfo, Connection, Host};
|
||||||
|
|
||||||
/// TCP connector service factory.
|
/// TCP connector service factory.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Clone, Copy, Default)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub struct TcpConnector;
|
pub struct TcpConnector;
|
||||||
|
|
||||||
impl TcpConnector {
|
impl TcpConnector {
|
||||||
/// Returns a new TCP connector service.
|
/// Returns a new TCP connector service.
|
||||||
pub fn service(&self) -> TcpConnectorService {
|
pub fn service(&self) -> TcpConnectorService {
|
||||||
TcpConnectorService
|
TcpConnectorService::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +46,8 @@ impl<R: Host> ServiceFactory<ConnectInfo<R>> for TcpConnector {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TCP connector service.
|
/// TCP connector service.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone, Default)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub struct TcpConnectorService;
|
pub struct TcpConnectorService;
|
||||||
|
|
||||||
impl<R: Host> Service<ConnectInfo<R>> for TcpConnectorService {
|
impl<R: Host> Service<ConnectInfo<R>> for TcpConnectorService {
|
||||||
|
|
Loading…
Reference in New Issue