Struct fluvio_index::PackageId[][src]

pub struct PackageId<V = MaybeVersion> { /* fields omitted */ }

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

impl<T> PackageId<T>[src]

pub fn registry(&self) -> &Registry[src]

Return the registry of the package specified by this identifier

pub fn group(&self) -> &GroupName[src]

Return the group of the package specified by this identifier

pub fn name(&self) -> &PackageName[src]

Return the name of the package specified by this identifier

pub fn pretty(&self) -> impl Display[src]

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.

pub fn uid(&self) -> String[src]

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());

impl PackageId<WithVersion>[src]

pub fn new_versioned(
    name: PackageName,
    group: GroupName,
    version: Version
) -> Self
[src]

Create a new, versioned PackageId.

pub fn version(&self) -> &Version[src]

A PackageId indisputably has a version, no Option required.

impl PackageId<MaybeVersion>[src]

pub fn new_unversioned(name: PackageName, group: GroupName) -> Self[src]

Create a new PackageId with no version info.

pub fn into_versioned(self, version: Version) -> PackageId<WithVersion>[src]

Add a Version to any PackageId to create a PackageId

impl PackageId<MaybeVersion>[src]

pub fn maybe_version(&self) -> Option<&Version>[src]

Trait Implementations

impl<V: Clone> Clone for PackageId<V>[src]

impl<V: Debug> Debug for PackageId<V>[src]

impl<'de> Deserialize<'de> for PackageId<WithVersion>[src]

impl<'de> Deserialize<'de> for PackageId<MaybeVersion>[src]

impl Display for PackageId<WithVersion>[src]

impl Display for PackageId<MaybeVersion>[src]

impl FromStr for PackageId<WithVersion>[src]

type Err = Error

The associated error which can be returned from parsing.

impl FromStr for PackageId<MaybeVersion>[src]

type Err = Error

The associated error which can be returned from parsing.

impl<V: PartialEq> PartialEq<PackageId<V>> for PackageId<V>[src]

impl Serialize for PackageId<WithVersion>[src]

impl Serialize for PackageId<MaybeVersion>[src]

impl<V> StructuralPartialEq for PackageId<V>[src]

Auto Trait Implementations

impl<V> RefUnwindSafe for PackageId<V> where
    V: RefUnwindSafe

impl<V> Send for PackageId<V> where
    V: Send

impl<V> Sync for PackageId<V> where
    V: Sync

impl<V> Unpin for PackageId<V> where
    V: Unpin

impl<V> UnwindSafe for PackageId<V> where
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,