[][src]Struct bandsocks::ImageName

pub struct ImageName { /* fields omitted */ }

Parsed Docker-style image reference

This is an owned struct representing a docker "reference" (like a URI) which refers to an image, optionally at a specific version, which can be fetched from a registry server (possibly the configured default).

This tries to be format-compatible with Docker including its quirks.

A complete image name contains a Registry, Repository, Tag, and ContentDigest in that order. Only the Repository component is mandatory.

The Tag always begins with a : and the ContentDigest with an @, but delineating the optional Registry and the first section of the Repository requires heuristics. If this first section includes any dot (.) or colon (:) characters it is assumed to be a repository server. This same property (see Registry) ensures that the parsed registry uses https. The additional exception is a special case for "localhost", which is always interpreted as a registry name. Additionally, because it has no dots, it is interpreted as an unencrypted http registry at localhost.

When a ContentDigest is specified, it securely identifies the specific contents of an image's layer data and manifest. Remember that a name without a digest is only as trustworthy as the registry server and our connection to it.

Implementations

impl ImageName[src]

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

Returns a reference to the existing string representation of an ImageName

pub fn from_parts(
    registry: Option<&str>,
    repository: &str,
    tag: Option<&str>,
    digest: Option<&str>
) -> Result<Self, ImageError>
[src]

Parse an ImageName from its component pieces

This may fail either because of a problem with one of the components, or because the resulting path would be parsed in a manner other than intended. For example, a registry name could be parsed as the first section of the repository path.

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

Return references to the parsed components within this ImageName

pub fn version(&self) -> ImageVersion[src]

Returns the most specific available version

If the image name includes a digest, this returns the digest. Otherwise, it returns the tag, defaulting to latest if no tag is set.

pub fn parse(s: &str) -> Result<Self, ImageError>[src]

Parse a str as an ImageName

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

Returns a reference to the optional registry portion of the string.

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

Returns a reference to the repository portion of the string

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

Returns a reference to the optional tag portion of the string.

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

Returns a reference to the optional digest portion of the string.

pub fn registry(&self) -> Option<Registry>[src]

Returns the registry portion as a new object

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

Returns the repository portion as a new object

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

Returns the tag portion as a new object

pub fn content_digest(&self) -> Option<ContentDigest>[src]

Returns the digest portion as a new object

pub fn with_found_digest(
    &self,
    found_digest: &ContentDigest
) -> Result<ImageName, ImageError>
[src]

Create a new ImageName which includes the actual content digest we found

If the name already includes a digest, it is validated. On mismatch, an appropriate error will be returned. On match, or if no validation was requested, this returns a new specific ImageName with the provided digest.

Trait Implementations

impl Clone for ImageName[src]

impl Debug for ImageName[src]

impl Display for ImageName[src]

impl Eq for ImageName[src]

impl FromStr for ImageName[src]

type Err = ImageError

The associated error which can be returned from parsing.

impl Hash for ImageName[src]

impl Ord for ImageName[src]

impl PartialEq<ImageName> for ImageName[src]

impl PartialOrd<ImageName> for ImageName[src]

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> Instrument for T[src]

impl<T> Instrument for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,