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§
source§impl 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§
source§impl Debug for RegionProviderChain
impl Debug for RegionProviderChain
source§impl ProvideRegion for RegionProviderChain
impl ProvideRegion for RegionProviderChain
source§fn region(&self) -> ProvideRegion<'_> ⓘ
fn region(&self) -> ProvideRegion<'_> ⓘ
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§
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
Mutably borrows from an owned value. Read more
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>
Creates a shared type from an unshared type.