[][src]Struct oci_distribution::Reference

pub struct Reference { /* fields omitted */ }

An OCI image reference

Parsing references in the following formats is supported:

  • <registry>/<repository>
  • <registry>/<repository>:<tag>
  • <registry>/<repository>@<digest>
  • <registry>/<repository>:<tag>@<digest>

Examples

Parsing a tagged image reference:

use oci_distribution::Reference;

let reference: Reference = "docker.io/library/hello-world:latest".parse().unwrap();

assert_eq!("docker.io", reference.registry());
assert_eq!("library/hello-world", reference.repository());
assert_eq!(Some("latest"), reference.tag());
assert_eq!(None, reference.digest());

Implementations

impl Reference[src]

pub fn whole(&self) -> &str[src]

Get the original reference.

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

Get the registry name.

pub fn repository(&self) -> &str[src]

Get the repository (a.k.a the image name) of this reference

pub fn tag(&self) -> Option<&str>[src]

Get the tag for this reference.

pub fn digest(&self) -> Option<&str>[src]

Get the digest for this reference.

Trait Implementations

impl Clone for Reference[src]

impl Debug for Reference[src]

impl Display for Reference[src]

impl Eq for Reference[src]

impl FromStr for Reference[src]

type Err = Error

The associated error which can be returned from parsing.

impl Hash for Reference[src]

impl Into<String> for Reference[src]

impl PartialEq<Reference> for Reference[src]

impl StructuralEq for Reference[src]

impl StructuralPartialEq for Reference[src]

impl<'_> TryFrom<&'_ str> for Reference[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<String> for Reference[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

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<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

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

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

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.