Struct oci_client::Reference
source · 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_spec::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 clone_with_digest(&self, digest: String) -> Reference
pub fn clone_with_digest(&self, digest: String) -> Reference
Clone the Reference for the same image with a new 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.
If a mirror registry is set, it will be used instead of the original registry.
sourcepub fn repository(&self) -> &str
pub fn repository(&self) -> &str
Returns the name of the repository.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Reference
impl<'de> Deserialize<'de> for Reference
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Reference, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Reference, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Serialize for Reference
impl Serialize for Reference
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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.