pub struct HyperTransport<C = ProxyConnector<TimeoutConnector<HttpConnector>>> { /* private fields */ }Expand description
A transport implementation using hyper v1.x
This struct wraps a hyper client and implements the HttpTransport trait.
§Timeout Support
All three timeout types are fully supported via hyper-timeout:
connect_timeout- Timeout for establishing the TCP connectionread_timeout- Timeout for reading data from the connectionwrite_timeout- Timeout for writing data to the connection
Timeouts are configured using the builder pattern. See HyperTransportBuilder for details.
§Example
use launchdarkly_sdk_transport::HyperTransport;
// Create transport with default HTTP connector
let _transport = HyperTransport::new()?;
Implementations§
Source§impl HyperTransport
impl HyperTransport
Sourcepub fn new() -> Result<Self, Error>
pub fn new() -> Result<Self, Error>
Create a new HyperTransport with default HTTP connector and no timeouts
This creates a basic HTTP-only client that supports both HTTP/1 and HTTP/2.
For HTTPS support or timeout configuration, use HyperTransport::builder().
Sourcepub fn new_https() -> Result<HyperTransport<ProxyConnector<TimeoutConnector<HttpsConnector<HttpConnector>>>>, Error>
pub fn new_https() -> Result<HyperTransport<ProxyConnector<TimeoutConnector<HttpsConnector<HttpConnector>>>>, Error>
Create a new HyperTransport with HTTPS support using hyper-tls
This creates an HTTPS client that supports both HTTP/1 and HTTP/2 protocols using the native TLS implementation. The transport can handle both HTTP and HTTPS connections.
This method is only available when the native-tls feature is enabled.
For timeout configuration or custom TLS settings, use HyperTransport::builder() instead.
Sourcepub fn builder() -> HyperTransportBuilder
pub fn builder() -> HyperTransportBuilder
Create a new builder for configuring HyperTransport
The builder allows you to configure timeouts and choose between HTTP and HTTPS connectors.
§Example
use launchdarkly_sdk_transport::HyperTransport;
use std::time::Duration;
let transport = HyperTransport::builder()
.connect_timeout(Duration::from_secs(10))
.read_timeout(Duration::from_secs(30))
.build_http();Trait Implementations§
Source§impl<C: Clone> Clone for HyperTransport<C>
impl<C: Clone> Clone for HyperTransport<C>
Source§fn clone(&self) -> HyperTransport<C>
fn clone(&self) -> HyperTransport<C>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more