pub enum ProviderSelection {
Auto,
Named {
primary: ProviderName,
fallbacks: Vec<ProviderName>,
},
}Expand description
Provider candidates used by registry selection.
Variants§
Auto
Select providers automatically by registry priority.
Named
Try a primary provider followed by explicit fallback providers.
Fields
primary: ProviderNamePrimary provider candidate.
fallbacks: Vec<ProviderName>Ordered fallback provider candidates.
Implementations§
Source§impl ProviderSelection
impl ProviderSelection
Sourcepub fn auto() -> ProviderSelection
pub fn auto() -> ProviderSelection
Sourcepub fn named(primary: &str) -> Result<ProviderSelection, ProviderRegistryError>
pub fn named(primary: &str) -> Result<ProviderSelection, ProviderRegistryError>
Creates a named provider selection without fallbacks.
§Parameters
primary: Primary provider name.
§Returns
Named provider selection.
§Errors
Returns ProviderRegistryError when primary is not a valid provider
name.
Sourcepub fn from_names(
primary: &str,
fallbacks: &[&str],
) -> Result<ProviderSelection, ProviderRegistryError>
pub fn from_names( primary: &str, fallbacks: &[&str], ) -> Result<ProviderSelection, ProviderRegistryError>
Creates a named provider selection from borrowed fallback names.
§Parameters
primary: Primary provider name.fallbacks: Ordered fallback provider names.
§Returns
Named provider selection.
§Errors
Returns ProviderRegistryError when primary or any fallback is not a
valid provider name.
Sourcepub fn from_owned_names(
primary: &str,
fallbacks: &[String],
) -> Result<ProviderSelection, ProviderRegistryError>
pub fn from_owned_names( primary: &str, fallbacks: &[String], ) -> Result<ProviderSelection, ProviderRegistryError>
Creates a named provider selection from owned fallback names.
§Parameters
primary: Primary provider name.fallbacks: Ordered fallback provider names.
§Returns
Named provider selection.
§Errors
Returns ProviderRegistryError when primary or any fallback is not a
valid provider name.
Sourcepub fn is_auto(&self) -> bool
pub fn is_auto(&self) -> bool
Tells whether this selection requests automatic selection.
§Returns
true when this selection is ProviderSelection::Auto.
Sourcepub fn primary(&self) -> Option<&ProviderName>
pub fn primary(&self) -> Option<&ProviderName>
Gets the primary provider for named selections.
§Returns
Some primary provider for named selections, or None for automatic
selection.
Sourcepub fn fallbacks(&self) -> &[ProviderName]
pub fn fallbacks(&self) -> &[ProviderName]
Gets ordered fallback provider names.
§Returns
Fallback provider names, or an empty slice for automatic selection.
Trait Implementations§
Source§impl Clone for ProviderSelection
impl Clone for ProviderSelection
Source§fn clone(&self) -> ProviderSelection
fn clone(&self) -> ProviderSelection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProviderSelection
impl Debug for ProviderSelection
Source§impl Default for ProviderSelection
impl Default for ProviderSelection
Source§fn default() -> ProviderSelection
fn default() -> ProviderSelection
Creates an automatic provider selection.
Source§impl PartialEq for ProviderSelection
impl PartialEq for ProviderSelection
Source§fn eq(&self, other: &ProviderSelection) -> bool
fn eq(&self, other: &ProviderSelection) -> bool
self and other values to be equal, and is used by ==.impl Eq for ProviderSelection
impl StructuralPartialEq for ProviderSelection
Auto Trait Implementations§
impl Freeze for ProviderSelection
impl RefUnwindSafe for ProviderSelection
impl Send for ProviderSelection
impl Sync for ProviderSelection
impl Unpin for ProviderSelection
impl UnsafeUnpin for ProviderSelection
impl UnwindSafe for ProviderSelection
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T, D> IntoConfigDefault<T> for Dwhere
D: IntoValueDefault<T>,
impl<T, D> IntoConfigDefault<T> for Dwhere
D: IntoValueDefault<T>,
Source§fn into_config_default(self) -> T
fn into_config_default(self) -> T
T.