hashes:: Polish crate level rustdocs

`hashes v1.0.0` is close, make an effort to polish the crate level rustdocs.
This commit is contained in:
Tobin C. Harding 2024-10-16 12:25:06 +11:00
parent 98691186dc
commit 1cb24c1f15
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 9 additions and 9 deletions

View File

@ -2,10 +2,8 @@
//! Rust hashes library.
//!
//! This is a simple, no-dependency library which implements the hash functions
//! needed by Bitcoin. These are SHA256, SHA256d, and RIPEMD160. As an ancillary
//! thing, it exposes hexadecimal serialization and deserialization, since these
//! are needed to display hashes anway.
//! This library implements the hash functions needed by Bitcoin. As an ancillary thing, it exposes
//! hexadecimal serialization and deserialization, since these are needed to display hashes.
//!
//! ## Commonly used operations
//!
@ -23,9 +21,10 @@
//! Hashing content from a reader:
//!
//! ```
//! #[cfg(feature = "std")] {
//! # #[cfg(feature = "std")] {
//! use bitcoin_hashes::Sha256;
//! let mut reader: &[u8] = b"hello"; // in real code, this could be a `File` or `TcpStream`
//!
//! let mut reader: &[u8] = b"hello"; // In real code, this could be a `File` or `TcpStream`.
//! let mut engine = Sha256::engine();
//! std::io::copy(&mut reader, &mut engine).unwrap();
//! let _hash = Sha256::from_engine(engine);
@ -33,12 +32,13 @@
//! ```
//!
//!
//! Hashing content by [`std::io::Write`] on `HashEngine`:
//! Hashing content using [`std::io::Write`] on a `HashEngine`:
//!
//! ```
//! #[cfg(feature = "std")] {
//! use std::io::Write as _; // Or `bitcoin-io::Write` if `bitcoin-io` feature is enabled.
//! # #[cfg(feature = "std")] {
//! use std::io::Write as _;
//! use bitcoin_hashes::Sha256;
//!
//! let part1: &[u8] = b"hello";
//! let part2: &[u8] = b" ";
//! let part3: &[u8] = b"world";