Skip to content

Commit d5dbeac

Browse files
committed
wip
1 parent 51afb8d commit d5dbeac

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/image/digest.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ fn char_is_encoded(c: char) -> bool {
8484
/// ```
8585
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
8686
/// use std::str::FromStr;
87-
/// use oci_spec::image::Digest;
87+
/// use oci_spec::image::{Digest, DigestAlgorithm};
8888
/// let d = Digest::from_str("sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b")?;
89-
/// assert_eq!(d.algorithm(), "sha256");
90-
/// assert_eq!(d.value(), "6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b");
89+
/// assert_eq!(d.algorithm(), &DigestAlgorithm::Sha256);
90+
/// assert_eq!(d.digest(), "6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b");
9191
/// let d = Digest::from_str("multihash+base58:QmRZxt2b1FVZPNqd8hsiykDL3TdBDeTSPX9Kv46HmX4Gx8")?;
92-
/// assert_eq!(d.algorithm(), "multihash+base58");
93-
/// assert_eq!(d.value(), "QmRZxt2b1FVZPNqd8hsiykDL3TdBDeTSPX9Kv46HmX4Gx8");
92+
/// assert_eq!(d.algorithm(), &DigestAlgorithm::from("multihash+base58"));
93+
/// assert_eq!(d.digest(), "QmRZxt2b1FVZPNqd8hsiykDL3TdBDeTSPX9Kv46HmX4Gx8");
9494
/// # Ok(())
9595
/// # }
9696
/// ```
@@ -194,12 +194,12 @@ impl FromStr for Digest {
194194
/// ```
195195
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
196196
/// use std::str::FromStr;
197-
/// use oci_spec::image::{Digest, Sha256Digest};
197+
/// use oci_spec::image::{DigestAlgorithm, Digest, Sha256Digest};
198198
/// let d = Digest::from_str("sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b")?;
199-
/// assert_eq!(d.algorithm(), "sha256");
200-
/// assert_eq!(d.value(), "6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b");
199+
/// assert_eq!(d.algorithm(), &DigestAlgorithm::Sha256);
200+
/// assert_eq!(d.digest(), "6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b");
201201
/// let d = Sha256Digest::try_from(d)?;
202-
/// assert_eq!(d.value(), "6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b");
202+
/// assert_eq!(d.digest(), "6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b");
203203
/// // But other digests will fail to be converted
204204
/// let d = Digest::from_str("multihash+base58:QmRZxt2b1FVZPNqd8hsiykDL3TdBDeTSPX9Kv46HmX4Gx8")?;
205205
/// assert!(Sha256Digest::try_from(d).is_err());

0 commit comments

Comments
 (0)