Struct rustainers::ImageName
source · pub struct ImageName { /* private fields */ }Expand description
An image name.
It contains the name, and optionally a tag or a digest.
Example
Create an constant image
const POSTGRES_IMAGE: &ImageName = &ImageName::new("postgres");Parse an image name:
let image = "minio/minio".parse::<ImageName>().unwrap();
assert_eq!(image.to_string(), "minio/minio");
let image_with_tag = "postgres:15.2".parse::<ImageName>().unwrap();
assert_eq!(image_with_tag.to_string(), "postgres:15.2");
let image_with_digest = "redis@sha256:1f9f545dd3d396ee72ca4588d31168341247e46b7e70fabca82f88a809d407a8".parse::<ImageName>().unwrap();
assert_eq!(image_with_digest.to_string(), "redis@sha256:1f9f545dd3d396ee72ca4588d31168341247e46b7e70fabca82f88a809d407a8");Implementations§
source§impl ImageName
impl ImageName
sourcepub const fn new_with_tag(repository: &'static str, tag: &'static str) -> Self
pub const fn new_with_tag(repository: &'static str, tag: &'static str) -> Self
Create a new image with a tag
sourcepub const fn new_with_digest(
repository: &'static str,
digest: &'static str
) -> Self
pub const fn new_with_digest( repository: &'static str, digest: &'static str ) -> Self
Create a new image with a digest
sourcepub fn set_digest(&mut self, digest: impl Into<String>)
pub fn set_digest(&mut self, digest: impl Into<String>)
Set the image digest
Trait Implementations§
source§impl From<ImageName> for ImageReference
impl From<ImageName> for ImageReference
source§impl PartialEq for ImageName
impl PartialEq for ImageName
impl Eq for ImageName
impl StructuralEq for ImageName
impl StructuralPartialEq for ImageName
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§
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.