Skip to content

Commit a7c2eae

Browse files
authored
Merge pull request #691 from newpavlov/doc_links
Use RFC 1946 for doc links
2 parents 4336232 + b72b6ae commit a7c2eae

File tree

25 files changed

+270
-397
lines changed

25 files changed

+270
-397
lines changed

rand_chacha/src/chacha.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ const STATE_WORDS: usize = 16;
6262
/// [^2]: [eSTREAM: the ECRYPT Stream Cipher Project](
6363
/// http://www.ecrypt.eu.org/stream/)
6464
///
65-
/// [`set_word_pos`]: #method.set_word_pos
66-
/// [`set_stream`]: #method.set_stream
67-
/// [`BlockRng`]: ../rand_core/block/struct.BlockRng.html
68-
/// [`RngCore`]: ../rand_core/trait.RngCore.html
65+
/// [`set_word_pos`]: ChaChaRng::set_word_pos
66+
/// [`set_stream`]: ChaChaRng::set_stream
6967
#[derive(Clone, Debug)]
7068
pub struct ChaChaRng(BlockRng<ChaChaCore>);
7169

rand_core/src/block.rs

+24-33
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,39 @@
1616
//! implementations only need to concern themselves with generation of the
1717
//! block, not the various [`RngCore`] methods (especially [`fill_bytes`], where
1818
//! the optimal implementations are not trivial), and this allows
19-
//! [`ReseedingRng`] perform periodic reseeding with very low overhead.
19+
//! `ReseedingRng` (see [`rand`](https://docs.rs/rand) crate) perform periodic
20+
//! reseeding with very low overhead.
2021
//!
2122
//! # Example
22-
//!
23+
//!
2324
//! ```norun
2425
//! use rand_core::block::{BlockRngCore, BlockRng};
25-
//!
26+
//!
2627
//! struct MyRngCore;
27-
//!
28+
//!
2829
//! impl BlockRngCore for MyRngCore {
2930
//! type Results = [u32; 16];
30-
//!
31+
//!
3132
//! fn generate(&mut self, results: &mut Self::Results) {
3233
//! unimplemented!()
3334
//! }
3435
//! }
35-
//!
36+
//!
3637
//! impl SeedableRng for MyRngCore {
3738
//! type Seed = unimplemented!();
3839
//! fn from_seed(seed: Self::Seed) -> Self {
3940
//! unimplemented!()
4041
//! }
4142
//! }
42-
//!
43+
//!
4344
//! // optionally, also implement CryptoRng for MyRngCore
44-
//!
45+
//!
4546
//! // Final RNG.
4647
//! type MyRng = BlockRng<u32, MyRngCore>;
4748
//! ```
48-
//!
49-
//! [`BlockRngCore`]: trait.BlockRngCore.html
50-
//! [`RngCore`]: ../trait.RngCore.html
51-
//! [`fill_bytes`]: ../trait.RngCore.html#tymethod.fill_bytes
52-
//! [`ReseedingRng`]: ../../rand/rngs/adapter/struct.ReseedingRng.html
49+
//!
50+
//! [`BlockRngCore`]: crate::block::BlockRngCore
51+
//! [`fill_bytes`]: RngCore::fill_bytes
5352
5453
use core::convert::AsRef;
5554
use core::fmt;
@@ -59,12 +58,12 @@ use impls::{fill_via_u32_chunks, fill_via_u64_chunks};
5958
/// A trait for RNGs which do not generate random numbers individually, but in
6059
/// blocks (typically `[u32; N]`). This technique is commonly used by
6160
/// cryptographic RNGs to improve performance.
62-
///
63-
/// See the [module documentation](index.html) for details.
61+
///
62+
/// See the [module][crate::block] documentation for details.
6463
pub trait BlockRngCore {
6564
/// Results element type, e.g. `u32`.
6665
type Item;
67-
66+
6867
/// Results type. This is the 'block' an RNG implementing `BlockRngCore`
6968
/// generates, which will usually be an array like `[u32; 16]`.
7069
type Results: AsRef<[Self::Item]> + AsMut<[Self::Item]> + Default;
@@ -105,15 +104,10 @@ pub trait BlockRngCore {
105104
///
106105
/// For easy initialization `BlockRng` also implements [`SeedableRng`].
107106
///
108-
/// [`BlockRngCore`]: BlockRngCore.t.html
109-
/// [`BlockRngCore::generate`]: trait.BlockRngCore.html#tymethod.generate
110-
/// [`BlockRng64`]: struct.BlockRng64.html
111-
/// [`RngCore`]: ../RngCore.t.html
112-
/// [`next_u32`]: ../trait.RngCore.html#tymethod.next_u32
113-
/// [`next_u64`]: ../trait.RngCore.html#tymethod.next_u64
114-
/// [`fill_bytes`]: ../trait.RngCore.html#tymethod.fill_bytes
115-
/// [`try_fill_bytes`]: ../trait.RngCore.html#tymethod.try_fill_bytes
116-
/// [`SeedableRng`]: ../SeedableRng.t.html
107+
/// [`next_u32`]: RngCore::next_u32
108+
/// [`next_u64`]: RngCore::next_u64
109+
/// [`fill_bytes`]: RngCore::fill_bytes
110+
/// [`try_fill_bytes`]: RngCore::try_fill_bytes
117111
#[derive(Clone)]
118112
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
119113
pub struct BlockRng<R: BlockRngCore + ?Sized> {
@@ -147,7 +141,7 @@ impl<R: BlockRngCore> BlockRng<R> {
147141
}
148142

149143
/// Get the index into the result buffer.
150-
///
144+
///
151145
/// If this is equal to or larger than the size of the result buffer then
152146
/// the buffer is "empty" and `generate()` must be called to produce new
153147
/// results.
@@ -314,13 +308,10 @@ impl<R: BlockRngCore + SeedableRng> SeedableRng for BlockRng<R> {
314308
/// values. If the requested length is not a multiple of 8, some bytes will be
315309
/// discarded.
316310
///
317-
/// [`BlockRngCore`]: BlockRngCore.t.html
318-
/// [`RngCore`]: ../RngCore.t.html
319-
/// [`next_u32`]: ../trait.RngCore.html#tymethod.next_u32
320-
/// [`next_u64`]: ../trait.RngCore.html#tymethod.next_u64
321-
/// [`fill_bytes`]: ../trait.RngCore.html#tymethod.fill_bytes
322-
/// [`try_fill_bytes`]: ../trait.RngCore.html#tymethod.try_fill_bytes
323-
/// [`BlockRng`]: struct.BlockRng.html
311+
/// [`next_u32`]: RngCore::next_u32
312+
/// [`next_u64`]: RngCore::next_u64
313+
/// [`fill_bytes`]: RngCore::fill_bytes
314+
/// [`try_fill_bytes`]: RngCore::try_fill_bytes
324315
#[derive(Clone)]
325316
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
326317
pub struct BlockRng64<R: BlockRngCore + ?Sized> {

0 commit comments

Comments
 (0)