pub struct RepositoryName(/* private fields */);Expand description
A validated repository name.
Implementations§
Source§impl RepositoryName
impl RepositoryName
Sourcepub fn new(value: impl AsRef<str>) -> Result<RepositoryName, DistributionError>
pub fn new(value: impl AsRef<str>) -> Result<RepositoryName, DistributionError>
Creates a repository name.
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the repository text.
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}Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consumes the repository and returns the owned string.
Trait Implementations§
Source§impl Clone for RepositoryName
impl Clone for RepositoryName
Source§fn clone(&self) -> RepositoryName
fn clone(&self) -> RepositoryName
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 RepositoryName
impl Debug for RepositoryName
Source§impl Display for RepositoryName
impl Display for RepositoryName
Source§impl FromStr for RepositoryName
impl FromStr for RepositoryName
Source§type Err = DistributionError
type Err = DistributionError
The associated error which can be returned from parsing.
Source§fn from_str(
value: &str,
) -> Result<RepositoryName, <RepositoryName as FromStr>::Err>
fn from_str( value: &str, ) -> Result<RepositoryName, <RepositoryName as FromStr>::Err>
Parses a string
s to return a value of this type. Read moreSource§impl Hash for RepositoryName
impl Hash for RepositoryName
Source§impl Ord for RepositoryName
impl Ord for RepositoryName
Source§fn cmp(&self, other: &RepositoryName) -> Ordering
fn cmp(&self, other: &RepositoryName) -> 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 RepositoryName
impl PartialEq for RepositoryName
Source§fn eq(&self, other: &RepositoryName) -> bool
fn eq(&self, other: &RepositoryName) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for RepositoryName
impl PartialOrd for RepositoryName
impl Eq for RepositoryName
impl StructuralPartialEq for RepositoryName
Auto Trait Implementations§
impl Freeze for RepositoryName
impl RefUnwindSafe for RepositoryName
impl Send for RepositoryName
impl Sync for RepositoryName
impl Unpin for RepositoryName
impl UnsafeUnpin for RepositoryName
impl UnwindSafe for RepositoryName
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