-
Notifications
You must be signed in to change notification settings - Fork 53
Closed
Description
From: http-rs/surf#237
Right now the
Client::with_http_client
method has the following signature:pub fn with_http_client(http_client: Arc<dyn HttpClient>) -> Self;This means that even if a backend we pass implements
Clone
, we must wrap it in anotherArc
. This leads to constructs such as:let mut app = tide::new(); let mut client = Client::with_http_client(Arc::new(app)); client.set_base_url("http://example.com/");Instead I'd like us to change the signature to:
pub fn connect_with<C>(http_client: C) -> crate::Result<Self> where C: HttpClient + Clone;Which will enable us to write:
let mut app = tide::new(); let mut client = Client::connect_with("http://example.com", app)?;
Metadata
Metadata
Assignees
Labels
No labels