pub struct Reference { /* private fields */ }
Expand description
Reference provides a general type to represent any way of referencing images within an OCI registry.
§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/library/hello-world:latest", reference.whole().as_str());
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§
Source§impl Reference
impl Reference
Sourcepub fn with_tag(registry: String, repository: String, tag: String) -> Reference
pub fn with_tag(registry: String, repository: String, tag: String) -> Reference
Create a Reference with a registry, repository and tag.
Sourcepub fn with_digest(
registry: String,
repository: String,
digest: String,
) -> Reference
pub fn with_digest( registry: String, repository: String, digest: String, ) -> Reference
Create a Reference with a registry, repository and digest.
Sourcepub fn resolve_registry(&self) -> &str
pub fn resolve_registry(&self) -> &str
Resolve the registry address of a given Reference
.
Some registries, such as docker.io, uses a different address for the actual registry. This function implements such redirection.
Sourcepub fn repository(&self) -> &str
pub fn repository(&self) -> &str
repository returns the name of the repository.
Trait Implementations§
impl Eq for Reference
impl StructuralPartialEq for Reference
Auto Trait Implementations§
impl Freeze for Reference
impl RefUnwindSafe for Reference
impl Send for Reference
impl Sync for Reference
impl Unpin for Reference
impl UnwindSafe for Reference
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more