Skip to content

Commit 70a2b62

Browse files
KSXGitHubtarcieri
andauthored
Add simpler code snippet to the documentation (#515)
Co-authored-by: Tony Arcieri <[email protected]>
1 parent e3ab257 commit 70a2b62

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

sha1/src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@
1111
//!
1212
//! # Usage
1313
//!
14+
//! ## One-shot API
15+
//!
16+
//! ```rust
17+
//! use hex_literal::hex;
18+
//! use sha1::{Sha1, Digest};
19+
//!
20+
//! let result = Sha1::digest(b"hello world");
21+
//! assert_eq!(result[..], hex!("2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"));
22+
//! ```
23+
//!
24+
//! ## Incremental API
25+
//!
1426
//! ```rust
1527
//! use hex_literal::hex;
1628
//! use sha1::{Sha1, Digest};

sha2/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,20 @@
1111
//!
1212
//! # Usage
1313
//!
14+
//! ## One-shot API
15+
//!
16+
//! ```rust
17+
//! use hex_literal::hex;
18+
//! use sha2::{Sha256, Digest};
19+
//!
20+
//! let result = Sha256::digest(b"hello world");
21+
//! assert_eq!(result[..], hex!("
22+
//! b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9
23+
//! ")[..]);
24+
//! ```
25+
//!
26+
//! ## Incremental API
27+
//!
1428
//! ```rust
1529
//! use hex_literal::hex;
1630
//! use sha2::{Sha256, Sha512, Digest};

0 commit comments

Comments
 (0)