Skip to content

Commit 44a32b4

Browse files
authored
Merge pull request #30 from Fishrock123/allow-dyn-HttpClient
HttpClient: remove Clone bounds, ensure unsized
2 parents 46e9b84 + 7d9e9c5 commit 44a32b4

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/lib.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,12 @@ pub use http_types;
4747
/// trait from there together with all existing HTTP client implementations.__
4848
///
4949
/// ## Spawning new request from middleware
50-
/// When threading the trait through a layer of middleware, the middleware must be able to perform
51-
/// new requests. In order to enable this we pass an `HttpClient` instance through the middleware,
52-
/// with a `Clone` implementation. In order to spawn a new request, `clone` is called, and a new
53-
/// request is enabled.
5450
///
55-
/// How `Clone` is implemented is up to the implementors, but in an ideal scenario combining this
56-
/// with the `Client` builder will allow for high connection reuse, improving latency.
57-
pub trait HttpClient: std::fmt::Debug + Unpin + Send + Sync + Clone + 'static {
51+
/// When threading the trait through a layer of middleware, the middleware must be able to perform
52+
/// new requests. In order to enable this efficiently an `HttpClient` instance may want to be passed
53+
/// though middleware for one of its own requests, and in order to do so should be wrapped in an
54+
/// `Rc`/`Arc` to enable reference cloning.
55+
pub trait HttpClient: std::fmt::Debug + Unpin + Send + Sync + 'static {
5856
/// The associated error type.
5957
type Error: Send + Sync + Into<Error>;
6058

0 commit comments

Comments
 (0)