pub struct ImageReference { /* private fields */ }Expand description
A parsed OCI image reference with optional tag and digest.
Implementations§
Source§impl ImageReference
impl ImageReference
Sourcepub fn parse(value: impl AsRef<str>) -> Result<ImageReference, ReferenceError>
pub fn parse(value: impl AsRef<str>) -> Result<ImageReference, ReferenceError>
Parses image reference text.
Sourcepub const fn registry(&self) -> Option<&RegistryHost>
pub const fn registry(&self) -> Option<&RegistryHost>
Returns the optional registry.
Sourcepub const fn repository(&self) -> &RepositoryName
pub const fn repository(&self) -> &RepositoryName
Returns the repository.
Examples found in repository?
examples/basic_usage.rs (line 20)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let parsed_digest: digest::OciDigest =
5 "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".parse()?;
6 let descriptor = descriptor::OciDescriptor::new(
7 media_type::OciMediaType::image_manifest(),
8 parsed_digest,
9 descriptor::DescriptorSize::new(7023),
10 );
11 let linux_arm64 =
12 platform::OciPlatform::new(platform::OciOs::Linux, platform::OciArchitecture::Arm64);
13 let title = annotation::Annotation::title("RustUse OCI example")?;
14 let image_ref: reference::ImageReference =
15 "ghcr.io/rustuse/app:0.1.0@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".parse()?;
16
17 assert_eq!(descriptor.size().as_u64(), 7023);
18 assert_eq!(linux_arm64.to_string(), "linux/arm64");
19 assert_eq!(title.value().as_str(), "RustUse OCI example");
20 assert_eq!(image_ref.repository().as_str(), "rustuse/app");
21 Ok(())
22}Trait Implementations§
Source§impl Clone for ImageReference
impl Clone for ImageReference
Source§fn clone(&self) -> ImageReference
fn clone(&self) -> ImageReference
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ImageReference
impl Debug for ImageReference
Source§impl Display for ImageReference
impl Display for ImageReference
Source§impl FromStr for ImageReference
impl FromStr for ImageReference
Source§type Err = ReferenceError
type Err = ReferenceError
The associated error which can be returned from parsing.
Source§fn from_str(
value: &str,
) -> Result<ImageReference, <ImageReference as FromStr>::Err>
fn from_str( value: &str, ) -> Result<ImageReference, <ImageReference as FromStr>::Err>
Parses a string
s to return a value of this type. Read moreSource§impl Hash for ImageReference
impl Hash for ImageReference
Source§impl Ord for ImageReference
impl Ord for ImageReference
Source§fn cmp(&self, other: &ImageReference) -> Ordering
fn cmp(&self, other: &ImageReference) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ImageReference
impl PartialEq for ImageReference
Source§fn eq(&self, other: &ImageReference) -> bool
fn eq(&self, other: &ImageReference) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for ImageReference
impl PartialOrd for ImageReference
Source§impl TryFrom<&str> for ImageReference
impl TryFrom<&str> for ImageReference
Source§type Error = ReferenceError
type Error = ReferenceError
The type returned in the event of a conversion error.
Source§fn try_from(
value: &str,
) -> Result<ImageReference, <ImageReference as TryFrom<&str>>::Error>
fn try_from( value: &str, ) -> Result<ImageReference, <ImageReference as TryFrom<&str>>::Error>
Performs the conversion.
impl Eq for ImageReference
impl StructuralPartialEq for ImageReference
Auto Trait Implementations§
impl Freeze for ImageReference
impl RefUnwindSafe for ImageReference
impl Send for ImageReference
impl Sync for ImageReference
impl Unpin for ImageReference
impl UnsafeUnpin for ImageReference
impl UnwindSafe for ImageReference
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