pub struct DescriptorSize(/* private fields */);Expand description
Descriptor size in bytes.
Implementations§
Source§impl DescriptorSize
impl DescriptorSize
Sourcepub const fn new(value: u64) -> DescriptorSize
pub const fn new(value: u64) -> DescriptorSize
Creates a descriptor size.
Examples found in repository?
examples/basic_usage.rs (line 9)
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 const fn as_u64(self) -> u64
pub const fn as_u64(self) -> u64
Returns the size in bytes.
Examples found in repository?
examples/basic_usage.rs (line 17)
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 DescriptorSize
impl Clone for DescriptorSize
Source§fn clone(&self) -> DescriptorSize
fn clone(&self) -> DescriptorSize
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 DescriptorSize
impl Debug for DescriptorSize
Source§impl Hash for DescriptorSize
impl Hash for DescriptorSize
Source§impl Ord for DescriptorSize
impl Ord for DescriptorSize
Source§fn cmp(&self, other: &DescriptorSize) -> Ordering
fn cmp(&self, other: &DescriptorSize) -> 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 DescriptorSize
impl PartialEq for DescriptorSize
Source§fn eq(&self, other: &DescriptorSize) -> bool
fn eq(&self, other: &DescriptorSize) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for DescriptorSize
impl PartialOrd for DescriptorSize
impl Copy for DescriptorSize
impl Eq for DescriptorSize
impl StructuralPartialEq for DescriptorSize
Auto Trait Implementations§
impl Freeze for DescriptorSize
impl RefUnwindSafe for DescriptorSize
impl Send for DescriptorSize
impl Sync for DescriptorSize
impl Unpin for DescriptorSize
impl UnsafeUnpin for DescriptorSize
impl UnwindSafe for DescriptorSize
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