Struct fluvio_index::PackageId [−][src]
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
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]
name: PackageName,
group: GroupName,
version: Version
) -> Self
Create a new, versioned PackageId.
pub fn version(&self) -> &Version
[src]
A PackageId
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]
fn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
impl<'de> Deserialize<'de> for PackageId<MaybeVersion>
[src]
fn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
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.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl FromStr for PackageId<MaybeVersion>
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl<V: PartialEq> PartialEq<PackageId<V>> for PackageId<V>
[src]
impl Serialize for PackageId<WithVersion>
[src]
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
impl Serialize for PackageId<MaybeVersion>
[src]
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
impl<V> StructuralPartialEq for PackageId<V>
[src]
Auto Trait Implementations
impl<V> RefUnwindSafe for PackageId<V> where
V: RefUnwindSafe,
V: RefUnwindSafe,
impl<V> Send for PackageId<V> where
V: Send,
V: Send,
impl<V> Sync for PackageId<V> where
V: Sync,
V: Sync,
impl<V> Unpin for PackageId<V> where
V: Unpin,
V: Unpin,
impl<V> UnwindSafe for PackageId<V> where
V: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,