From d5dbeac4e2ca5c8994aa39c89b5a1ab68dc7a92e Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sat, 7 Sep 2024 15:45:59 +0000 Subject: [PATCH] wip --- src/image/digest.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/image/digest.rs b/src/image/digest.rs index 16e7d2af57..cfc9b52783 100644 --- a/src/image/digest.rs +++ b/src/image/digest.rs @@ -84,13 +84,13 @@ fn char_is_encoded(c: char) -> bool { /// ``` /// # fn main() -> Result<(), Box> { /// use std::str::FromStr; -/// use oci_spec::image::Digest; +/// use oci_spec::image::{Digest, DigestAlgorithm}; /// let d = Digest::from_str("sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b")?; -/// assert_eq!(d.algorithm(), "sha256"); -/// assert_eq!(d.value(), "6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b"); +/// assert_eq!(d.algorithm(), &DigestAlgorithm::Sha256); +/// assert_eq!(d.digest(), "6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b"); /// let d = Digest::from_str("multihash+base58:QmRZxt2b1FVZPNqd8hsiykDL3TdBDeTSPX9Kv46HmX4Gx8")?; -/// assert_eq!(d.algorithm(), "multihash+base58"); -/// assert_eq!(d.value(), "QmRZxt2b1FVZPNqd8hsiykDL3TdBDeTSPX9Kv46HmX4Gx8"); +/// assert_eq!(d.algorithm(), &DigestAlgorithm::from("multihash+base58")); +/// assert_eq!(d.digest(), "QmRZxt2b1FVZPNqd8hsiykDL3TdBDeTSPX9Kv46HmX4Gx8"); /// # Ok(()) /// # } /// ``` @@ -194,12 +194,12 @@ impl FromStr for Digest { /// ``` /// # fn main() -> Result<(), Box> { /// use std::str::FromStr; -/// use oci_spec::image::{Digest, Sha256Digest}; +/// use oci_spec::image::{DigestAlgorithm, Digest, Sha256Digest}; /// let d = Digest::from_str("sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b")?; -/// assert_eq!(d.algorithm(), "sha256"); -/// assert_eq!(d.value(), "6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b"); +/// assert_eq!(d.algorithm(), &DigestAlgorithm::Sha256); +/// assert_eq!(d.digest(), "6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b"); /// let d = Sha256Digest::try_from(d)?; -/// assert_eq!(d.value(), "6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b"); +/// assert_eq!(d.digest(), "6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b"); /// // But other digests will fail to be converted /// let d = Digest::from_str("multihash+base58:QmRZxt2b1FVZPNqd8hsiykDL3TdBDeTSPX9Kv46HmX4Gx8")?; /// assert!(Sha256Digest::try_from(d).is_err());