Struct aws_config::meta::region::RegionProviderChain
source · [−]pub struct RegionProviderChain { /* private fields */ }
Expand description
Load a region by selecting the first from a series of region providers.
Examples
use aws_types::region::Region;
use std::env;
use aws_config::meta::region::RegionProviderChain;
// region provider that first checks the `CUSTOM_REGION` environment variable,
// then checks the default provider chain, then falls back to us-east-2
let provider = RegionProviderChain::first_try(env::var("CUSTOM_REGION").ok().map(Region::new))
.or_default_provider()
.or_else(Region::new("us-east-2"));
Implementations
sourceimpl RegionProviderChain
impl RegionProviderChain
sourcepub async fn region(&self) -> Option<Region>
pub async fn region(&self) -> Option<Region>
Load a region from the provider chain
The first provider to return a non-optional region will be selected
sourcepub fn first_try(provider: impl ProvideRegion + 'static) -> Self
pub fn first_try(provider: impl ProvideRegion + 'static) -> Self
Create a default provider chain that starts by checking this provider.
sourcepub fn or_else(self, fallback: impl ProvideRegion + 'static) -> Self
pub fn or_else(self, fallback: impl ProvideRegion + 'static) -> Self
Add a fallback provider to the region provider chain.
sourcepub fn default_provider() -> Self
pub fn default_provider() -> Self
Create a region provider chain that starts by checking the default provider.
sourcepub fn or_default_provider(self) -> Self
pub fn or_default_provider(self) -> Self
Fallback to the default provider
Trait Implementations
sourceimpl Debug for RegionProviderChain
impl Debug for RegionProviderChain
sourceimpl ProvideRegion for RegionProviderChain
impl ProvideRegion for RegionProviderChain
sourcefn region(&self) -> ProvideRegion<'_>ⓘNotable traits for ProvideRegion<'_>impl Future for ProvideRegion<'_> type Output = Option<Region>;
fn region(&self) -> ProvideRegion<'_>ⓘNotable traits for ProvideRegion<'_>impl Future for ProvideRegion<'_> type Output = Option<Region>;
Load a region from this provider
Auto Trait Implementations
impl !RefUnwindSafe for RegionProviderChain
impl Send for RegionProviderChain
impl Sync for RegionProviderChain
impl Unpin for RegionProviderChain
impl !UnwindSafe for RegionProviderChain
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more