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 named(primary: &str) -> Result<Self, ProviderRegistryError>
pub fn named(primary: &str) -> Result<Self, 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<Self, ProviderRegistryError>
pub fn from_names( primary: &str, fallbacks: &[&str], ) -> Result<Self, 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<Self, ProviderRegistryError>
pub fn from_owned_names( primary: &str, fallbacks: &[String], ) -> Result<Self, 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§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 ==.