pub struct Annotation { /* private fields */ }Expand description
An OCI annotation key/value pair.
Implementations§
Source§impl Annotation
impl Annotation
Sourcepub fn new(
key: impl AsRef<str>,
value: impl AsRef<str>,
) -> Result<Annotation, AnnotationError>
pub fn new( key: impl AsRef<str>, value: impl AsRef<str>, ) -> Result<Annotation, AnnotationError>
Creates an annotation.
Sourcepub fn title(value: impl AsRef<str>) -> Result<Annotation, AnnotationError>
pub fn title(value: impl AsRef<str>) -> Result<Annotation, AnnotationError>
Creates an OCI title annotation.
Examples found in repository?
examples/basic_usage.rs (line 13)
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}Sourcepub fn description(
value: impl AsRef<str>,
) -> Result<Annotation, AnnotationError>
pub fn description( value: impl AsRef<str>, ) -> Result<Annotation, AnnotationError>
Creates an OCI description annotation.
Sourcepub fn source(value: impl AsRef<str>) -> Result<Annotation, AnnotationError>
pub fn source(value: impl AsRef<str>) -> Result<Annotation, AnnotationError>
Creates an OCI source annotation.
Sourcepub const fn key(&self) -> &AnnotationKey
pub const fn key(&self) -> &AnnotationKey
Returns the key.
Sourcepub const fn value(&self) -> &AnnotationValue
pub const fn value(&self) -> &AnnotationValue
Returns the value.
Examples found in repository?
examples/basic_usage.rs (line 19)
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 Annotation
impl Clone for Annotation
Source§fn clone(&self) -> Annotation
fn clone(&self) -> Annotation
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 Annotation
impl Debug for Annotation
Source§impl Display for Annotation
impl Display for Annotation
Source§impl Hash for Annotation
impl Hash for Annotation
Source§impl Ord for Annotation
impl Ord for Annotation
Source§fn cmp(&self, other: &Annotation) -> Ordering
fn cmp(&self, other: &Annotation) -> 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 Annotation
impl PartialEq for Annotation
Source§fn eq(&self, other: &Annotation) -> bool
fn eq(&self, other: &Annotation) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for Annotation
impl PartialOrd for Annotation
impl Eq for Annotation
impl StructuralPartialEq for Annotation
Auto Trait Implementations§
impl Freeze for Annotation
impl RefUnwindSafe for Annotation
impl Send for Annotation
impl Sync for Annotation
impl Unpin for Annotation
impl UnsafeUnpin for Annotation
impl UnwindSafe for Annotation
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