[−][src]Struct bandsocks::ImageName
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]
registry: Option<&str>,
repository: &str,
tag: Option<&str>,
digest: Option<&str>
) -> Result<Self, ImageError>
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]
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]
&self,
found_digest: &ContentDigest
) -> Result<ImageName, ImageError>
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.
pub fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Hash for ImageName
[src]
pub fn hash<H: Hasher>(&self, state: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for ImageName
[src]
pub fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<ImageName> for ImageName
[src]
pub fn eq(&self, other: &Self) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<ImageName> for ImageName
[src]
Auto Trait Implementations
impl RefUnwindSafe for ImageName
impl Send for ImageName
impl Sync for ImageName
impl Unpin for ImageName
impl UnwindSafe for ImageName
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,