1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-09-01 01:16:59 +02:00

Use immutable reference of service state. Update awc dns resolver. (#1905)

This commit is contained in:
fakeshadow
2021-02-06 17:00:40 -08:00
committed by GitHub
parent 20cf0094e5
commit 41bc04b1c4
65 changed files with 497 additions and 538 deletions

View File

@@ -93,7 +93,6 @@
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
use std::cell::RefCell;
use std::convert::TryFrom;
use std::rc::Rc;
use std::time::Duration;
@@ -145,7 +144,7 @@ use self::connect::{Connect, ConnectorWrapper};
pub struct Client(Rc<ClientConfig>);
pub(crate) struct ClientConfig {
pub(crate) connector: RefCell<Box<dyn Connect>>,
pub(crate) connector: Box<dyn Connect>,
pub(crate) headers: HeaderMap,
pub(crate) timeout: Option<Duration>,
}
@@ -153,9 +152,7 @@ pub(crate) struct ClientConfig {
impl Default for Client {
fn default() -> Self {
Client(Rc::new(ClientConfig {
connector: RefCell::new(Box::new(ConnectorWrapper(
Connector::new().finish(),
))),
connector: Box::new(ConnectorWrapper(Connector::new().finish())),
headers: HeaderMap::new(),
timeout: Some(Duration::from_secs(5)),
}))