Struct fluvio_index::PackageId [−][src]
pub struct PackageId<V = MaybeVersion> { /* fields omitted */ }
Expand description
A unique identifier for a package that describes its registry, group, name, and (possibly) version.
There are two different variations of a PackageId, which have different formatting and parsing rules.
- A
PackageId<WithVersion>
represents a fully-qualified package name that also refers to a specific version of the package. It is rendered (and parsed) as a string in the following form:
<registry>/<group>/<name>:<version>
OR
<group>/<name>:<version>
OR
<name>:<version>
Note that a PackageId<WithVersion>
has strong guarantees on its
FromStr
implementation (and therefore, it’s parse()
rules). This
means that a PackageId<WithVersion>
is guaranteed to have a version
embedded in it, which can be accessed via .version()
.
- A
PackageId
(i.e.PackageId<MaybeVersion>
) might or might not contain a version, and will parse a package string that does OR does not have a version in it. This is the type you should use if you don’t need a version or if you want to do something different based on whether or not a version is given. An example of this might be installing a specific version of a package if a version is given, or defaulting to the latest version if not given.
Valid forms that will parse into a PackageId
include:
<registry>/<group>/<name>
<group>/<name>
<name>
<registry>/<group>/<name>:<version>
<group>/<name>:<version>
<name>:<version>
Implementations
Return the registry of the package specified by this identifier
Return the name of the package specified by this identifier
A printable representation of this PackageId
This displays the most concise representation of this PackageId
that is still unique.
For example, if the registry and group name are default values, this will display only
the package name. If the group name is non-standard, it will be printed. If the registry
is non-standard, both the registry and the group name will be printed.
A unique representation of this package, excluding version.
This is intended to be used for comparing two PackageId’s to see whether they refer to the same package entity, regardless of version.
Exmaple
let pid1: PackageId<MaybeVersion> = "fluvio/fluvio".parse().unwrap();
let pid2: PackageId<WithVersion> = "https://packages.fluvio.io/v1/fluvio/fluvio:1.2.3".parse().unwrap();
assert_eq!(pid1.uid(), pid2.uid());
A PackageId
Return the inner PackageVersion, consuming the PackageId
Convert to a PackageId<WithVersion>
preserving the inner Version
Convert to a PackageId<WithVersion>
, dropping the inner Version
Add a Version to any PackageId to create a PackageId
Trait Implementations
fn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
fn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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
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<V> RefUnwindSafe for PackageId<V> where
V: RefUnwindSafe,
impl<V> UnwindSafe for PackageId<V> where
V: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more