11// Copyright 2026-Present Datadog, Inc. https://www.datadoghq.com/
22// SPDX-License-Identifier: Apache-2.0
33
4+ use crate :: { config, HttpClientError , HttpRequest , HttpResponse } ;
5+ use std:: time:: Duration ;
6+
47#[ cfg( all( feature = "hyper-backend" , not( feature = "reqwest-backend" ) ) ) ]
58pub ( crate ) mod hyper_backend;
69#[ cfg( feature = "reqwest-backend" ) ]
@@ -9,13 +12,16 @@ pub(crate) mod reqwest_backend;
912/// The internal async transport backend.
1013///
1114/// This trait uses native AFIT (stable since Rust 1.75, MSRV is 1.84.1).
12- /// It is intentionally not object-safe — `HttpClient` holds a concrete backend
13- /// type, never a `dyn Backend`.
14- pub ( crate ) trait Backend {
15+ /// It is intentionally not object-safe — [HttpClient] holds a concrete backend type, never a `dyn
16+ /// Backend`.
17+ pub ( crate ) trait Backend : Sized {
18+ /// Construct a new backend with the given timeout and transport.
19+ fn new ( timeout : Duration , transport : config:: TransportConfig ) -> Result < Self , HttpClientError > ;
20+
1521 /// Send an HTTP request and return the response.
1622 async fn send (
1723 & self ,
18- request : crate :: HttpRequest ,
19- config : & crate :: config:: HttpClientConfig ,
20- ) -> Result < crate :: HttpResponse , crate :: HttpClientError > ;
24+ request : HttpRequest ,
25+ config : & config:: HttpClientConfig ,
26+ ) -> Result < HttpResponse , HttpClientError > ;
2127}
0 commit comments