pub struct RegistryMetadata {
pub preferred_protocol: Option<String>,
pub protocol_configs: HashMap<String, Map<String, Value>>,
/* private fields */
}Fields§
§preferred_protocol: Option<String>The registry’s preferred protocol.
protocol_configs: HashMap<String, Map<String, Value>>Protocol-specific configuration.
Implementations§
Source§impl RegistryMetadata
impl RegistryMetadata
Sourcepub fn preferred_protocol(&self) -> Option<&str>
pub fn preferred_protocol(&self) -> Option<&str>
Returns the registry’s preferred protocol.
The preferred protocol is:
- the
preferredProtocolmetadata field, if given - the protocol configuration key, if only one configuration is given
- the protocol backward-compatible aliases configuration, if only one configuration is given
Sourcepub fn configured_protocols(&self) -> impl Iterator<Item = Cow<'_, str>>
pub fn configured_protocols(&self) -> impl Iterator<Item = Cow<'_, str>>
Returns an iterator of protocols configured by the registry.
Sourcepub fn protocol_config<T>(&self, protocol: &str) -> Result<Option<T>, Error>where
T: DeserializeOwned,
pub fn protocol_config<T>(&self, protocol: &str) -> Result<Option<T>, Error>where
T: DeserializeOwned,
Deserializes protocol config for the given protocol.
Returns Ok(None) if no configuration is available for the given
protocol.
Returns Err if configuration is available for the given protocol but
deserialization fails.
Trait Implementations§
Source§impl Clone for RegistryMetadata
impl Clone for RegistryMetadata
Source§fn clone(&self) -> RegistryMetadata
fn clone(&self) -> RegistryMetadata
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RegistryMetadata
impl Debug for RegistryMetadata
Source§impl Default for RegistryMetadata
impl Default for RegistryMetadata
Source§fn default() -> RegistryMetadata
fn default() -> RegistryMetadata
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for RegistryMetadata
impl<'de> Deserialize<'de> for RegistryMetadata
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RegistryMetadata, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RegistryMetadata, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl RegistryMetadataExt for RegistryMetadata
impl RegistryMetadataExt for RegistryMetadata
Source§async fn fetch_or_default(registry: &Registry) -> Self
async fn fetch_or_default(registry: &Registry) -> Self
Attempt to fetch
RegistryMetadata from the given Registry. On
failure, return defaults.Source§impl Serialize for RegistryMetadata
impl Serialize for RegistryMetadata
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for RegistryMetadata
impl RefUnwindSafe for RegistryMetadata
impl Send for RegistryMetadata
impl Sync for RegistryMetadata
impl Unpin for RegistryMetadata
impl UnwindSafe for RegistryMetadata
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromBase64 for Twhere
T: for<'de> Deserialize<'de>,
impl<T> FromBase64 for Twhere
T: for<'de> Deserialize<'de>,
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>
Converts
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>
Converts
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 more