pub struct Builder<Tls = TlsUnset> { /* private fields */ }default-client only.Expand description
Builder for a hyper-backed HttpClient implementation.
This builder can be used to customize the underlying TCP connector used, as well as hyper client configuration.
§Examples
Construct a Hyper client with the RusTLS TLS implementation. This can be useful when you want to share a Hyper connector between multiple generated Smithy clients.
Implementations§
Source§impl Builder<TlsProviderSelected>
impl Builder<TlsProviderSelected>
Sourcepub fn build_https(self) -> SharedHttpClient
Available on crate features rustls-aws-lc or rustls-aws-lc-fips or rustls-ring or s2n-tls only.
pub fn build_https(self) -> SharedHttpClient
rustls-aws-lc or rustls-aws-lc-fips or rustls-ring or s2n-tls only.Create an HTTPS client with the selected TLS provider.
The trusted certificates will be loaded later when this becomes the selected HTTP client for a Smithy client.
Sourcepub fn build_with_resolver(
self,
resolver: impl ResolveDns + Clone + 'static,
) -> SharedHttpClient
Available on crate features rustls-aws-lc or rustls-aws-lc-fips or rustls-ring or s2n-tls only.
pub fn build_with_resolver( self, resolver: impl ResolveDns + Clone + 'static, ) -> SharedHttpClient
rustls-aws-lc or rustls-aws-lc-fips or rustls-ring or s2n-tls only.Create an HTTPS client using a custom DNS resolver
Sourcepub fn tls_context(self, ctx: TlsContext) -> Self
Available on crate features rustls-aws-lc or rustls-aws-lc-fips or rustls-ring or s2n-tls only.
pub fn tls_context(self, ctx: TlsContext) -> Self
rustls-aws-lc or rustls-aws-lc-fips or rustls-ring or s2n-tls only.Configure the TLS context
Source§impl<Any> Builder<Any>
impl<Any> Builder<Any>
Sourcepub fn pool_idle_timeout<D>(self, val: D) -> Self
pub fn pool_idle_timeout<D>(self, val: D) -> Self
Set an optional timeout for idle sockets being kept-alive.
Pass None to disable timeout.
Defaults to Hyper’s default timeout, which is currently 90 seconds - see
hyper_util::client::legacy::Builder::pool_idle_timeout,
but unlike that function, there is no need to call pool_timer yourself.
§Examples
use aws_smithy_http_client::{Builder, tls};
use std::time::Duration;
let client = Builder::new()
.pool_idle_timeout(Duration::from_secs(30))
.tls_provider(tls::Provider::Rustls(tls::rustls_provider::CryptoMode::AwsLc))
.build_https();Sourcepub fn set_pool_idle_timeout(
&mut self,
val: Option<Option<Duration>>,
) -> &mut Self
pub fn set_pool_idle_timeout( &mut self, val: Option<Option<Duration>>, ) -> &mut Self
Set an optional timeout for idle sockets being kept-alive.
Pass None to use Hyper’s default timeout, Some(None) to disable timeouts.
This is the mutable version of pool_idle_timeout.
§Examples
use std::time::Duration;
use aws_smithy_http_client::{Builder, tls};
let mut client = Builder::new();
client.set_pool_idle_timeout(Some(Some(Duration::from_secs(30))));
client
.tls_provider(tls::Provider::Rustls(tls::rustls_provider::CryptoMode::AwsLc))
.build_https();Source§impl Builder<TlsUnset>
impl Builder<TlsUnset>
Sourcepub fn tls_provider(self, provider: Provider) -> Builder<TlsProviderSelected>
pub fn tls_provider(self, provider: Provider) -> Builder<TlsProviderSelected>
Set the TLS implementation to use
Examples found in repository?
More examples
Trait Implementations§
Auto Trait Implementations§
impl<Tls> Freeze for Builder<Tls>where
Tls: Freeze,
impl<Tls = TlsUnset> !RefUnwindSafe for Builder<Tls>
impl<Tls> Send for Builder<Tls>where
Tls: Send,
impl<Tls> Sync for Builder<Tls>where
Tls: Sync,
impl<Tls> Unpin for Builder<Tls>where
Tls: Unpin,
impl<Tls = TlsUnset> !UnwindSafe for Builder<Tls>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);