Skip to content

Commit c1584f4

Browse files
committed
Incorporate README.md into rustdoc where it wasn't already
The `cipher`, `crypto-common`, and `digest` crates didn't yet do this
1 parent d9067c4 commit c1584f4

File tree

9 files changed

+49
-28
lines changed

9 files changed

+49
-28
lines changed

Cargo.lock

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ cast_possible_wrap = "warn"
2222
cast_precision_loss = "warn"
2323
cast_sign_loss = "warn"
2424
checked_conversions = "warn"
25-
doc_markdown = "warn"
2625
from_iter_instead_of_collect = "warn"
2726
implicit_saturating_sub = "warn"
2827
manual_assert = "warn"

cipher/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
[![Project Chat][chat-image]][chat-link]
88
[![Build Status][build-image]][build-link]
99

10-
Traits which define the functionality of [block ciphers] and [stream ciphers].
10+
Traits which define the functionality of [block ciphers], [block modes] and
11+
[stream ciphers].
1112

1213
See [RustCrypto/block-ciphers] and [RustCrypto/stream-ciphers] for algorithm
1314
implementations which use these traits.
@@ -48,6 +49,7 @@ dual licensed as above, without any additional terms or conditions.
4849
[//]: # (general links)
4950

5051
[block ciphers]: https://en.wikipedia.org/wiki/Block_cipher
52+
[block modes]: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation
5153
[stream ciphers]: https://en.wikipedia.org/wiki/Stream_cipher
5254
[RustCrypto/block-ciphers]: https://github.com/RustCrypto/block-ciphers
5355
[RustCrypto/stream-ciphers]: https://github.com/RustCrypto/stream-ciphers

cipher/src/lib.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
//! This crate defines a set of traits which describe the functionality of
2-
//! [block ciphers][1], [block modes][2], and [stream ciphers][3].
3-
//!
4-
//! [1]: https://en.wikipedia.org/wiki/Block_cipher
5-
//! [2]: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation
6-
//! [3]: https://en.wikipedia.org/wiki/Stream_cipher
7-
81
#![no_std]
92
#![cfg_attr(docsrs, feature(doc_cfg))]
3+
#![doc = include_str!("../README.md")]
104
#![doc(
115
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
126
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"

crypto-common/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
//! Common cryptographic traits.
2-
31
#![no_std]
42
#![cfg_attr(docsrs, feature(doc_cfg))]
3+
#![doc = include_str!("../README.md")]
54
#![doc(
65
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
76
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"
87
)]
98
#![forbid(unsafe_code)]
10-
#![warn(missing_docs, rust_2018_idioms, missing_debug_implementations)]
119

1210
/// Hazardous materials.
1311
pub mod hazmat;

digest/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ blobby = { version = "0.4", optional = true }
2222
const-oid = { version = "0.10", optional = true }
2323
zeroize = { version = "1.7", optional = true, default-features = false }
2424

25+
[dev-dependencies]
26+
sha2 = "0.11.0-rc.5"
27+
2528
[features]
2629
default = ["block-api"]
2730
block-api = ["block-buffer"] # Enable block API traits

digest/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ hasher.update(data);
3939
hasher.update("String data");
4040
// Note that calling `finalize()` consumes hasher
4141
let hash = hasher.finalize();
42-
println!("Result: {:x}", hash);
42+
println!("Result: {:?}", hash);
4343
```
4444

4545
In this example `hash` has type [`Array<u8, U32>`][2], which is a generic
@@ -49,19 +49,23 @@ Alternatively you can use chained approach, which is equivalent to the previous
4949
example:
5050

5151
```rust
52+
use sha2::{Sha256, Digest};
53+
5254
let hash = Sha256::new()
5355
.chain_update(b"Hello world!")
5456
.chain_update("String data")
5557
.finalize();
5658

57-
println!("Result: {:x}", hash);
59+
println!("Result: {:?}", hash);
5860
```
5961

6062
If the whole message is available you also can use convenience `digest` method:
6163

6264
```rust
65+
use sha2::{Sha256, Digest};
66+
6367
let hash = Sha256::digest(b"my message");
64-
println!("Result: {:x}", hash);
68+
println!("Result: {:?}", hash);
6569
```
6670

6771
### Generic code

digest/src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
//! This crate provides traits which describe functionality of cryptographic hash
2-
//! functions and Message Authentication algorithms.
1+
#![no_std]
2+
#![cfg_attr(docsrs, feature(doc_cfg))]
3+
#![doc = include_str!("../README.md")]
4+
#![forbid(unsafe_code)]
5+
#![doc(
6+
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
7+
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"
8+
)]
9+
#![warn(missing_docs, rust_2018_idioms, missing_debug_implementations)]
10+
11+
//! ## Structure
312
//!
4-
//! Traits in this repository are organized into the following levels:
13+
//! Traits in this crate are organized into the following levels:
514
//!
615
//! - **High-level convenience traits**: [`Digest`], [`DynDigest`], [`Mac`].
716
//! Wrappers around lower-level traits for most common use-cases. Users should
@@ -24,15 +33,6 @@
2433
//!
2534
//! [`digest-io`]: https://docs.rs/digest-io
2635
27-
#![no_std]
28-
#![cfg_attr(docsrs, feature(doc_cfg))]
29-
#![forbid(unsafe_code)]
30-
#![doc(
31-
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
32-
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"
33-
)]
34-
#![warn(missing_docs, rust_2018_idioms, missing_debug_implementations)]
35-
3636
#[cfg(feature = "alloc")]
3737
#[macro_use]
3838
extern crate alloc;

signature/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#![no_std]
2+
#![cfg_attr(docsrs, feature(doc_cfg))]
23
#![doc = include_str!("../README.md")]
34
#![doc(
45
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg",
56
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg"
67
)]
7-
#![cfg_attr(docsrs, feature(doc_cfg))]
88
#![forbid(unsafe_code)]
99
#![allow(async_fn_in_trait)]
1010
#![warn(

0 commit comments

Comments
 (0)