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.

  1. 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().

  1. 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 group 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 indisputably has a version, no Option required.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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