pub struct Reference {
pub repository: Repository,
pub tag: Option<String>,
pub digest: Option<String>,
}Expand description
A reference is a named reference to an image
Examples:
docker.io/library/alpinedocker.io/library/alpine:latestdocker.io/library/alpine@sha256:86e0e091d0da6bde2456dbb48306f3956bbeb2eae1b5b9a43045843f69fe4aaa
Fields§
§repository: RepositoryThe repository of the reference, (e.g. docker.io/library/alpine)
tag: Option<String>The tag of the reference, (e.g. latest)
digest: Option<String>The digest of the reference, (e.g. sha256:86e0e091d0da6bde2456dbb48306f3956bbeb2eae1b5b9a43045843f69fe4aaa)
Implementations§
Source§impl Reference
impl Reference
Sourcepub fn parse(s: impl AsRef<str>) -> Result<Self, Error>
pub fn parse(s: impl AsRef<str>) -> Result<Self, Error>
Parse parses s and returns a syntactically valid Reference
Sourcepub fn parse_normalized_named(s: &str) -> Result<Self, Error>
pub fn parse_normalized_named(s: &str) -> Result<Self, Error>
Parses a string into a named reference transforming a familiar name from Docker UI to a fully qualified reference
Sourcepub fn domain(&self) -> &str
pub fn domain(&self) -> &str
Returns the domain of the reference, or the default domain (docker.io) if it is not set
Sourcepub fn path(&self) -> Option<Cow<'_, str>>
pub fn path(&self) -> Option<Cow<'_, str>>
Returns the path of the reference, normalized if it is an official repository
Sourcepub fn rank_ord(&self, other: &Self) -> Ordering
pub fn rank_ord(&self, other: &Self) -> Ordering
rank_ord returns a Ordering based on the following rules preferring higher
information references, then by the lexicographical ordering of the reference string:
| Rule | Example |
|---|---|
| [Named] + [Tagged] + [Digested] | docker.io/library/busybox:latest@sha256:<digest> |
| [Named] + [Tagged] | docker.io/library/busybox:latest |
| [Named] + [Digested] | docker.io/library/busybo@sha256:<digest> |
| [Named] | docker.io/library/busybox |
| [Digested] | docker.io@sha256:<digest> |
| Error | The reference is not valid due to not matching any of the above rules |