Skip to content

Commit 7161690

Browse files
authored
Switch to #![doc = include_str!("../README.md")] (#23)
Additionally, updates README and simplifies it a bit.
1 parent 5d57a94 commit 7161690

File tree

3 files changed

+40
-67
lines changed

3 files changed

+40
-67
lines changed

Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ readme = "README.md"
77
repository = "https://github.com/rust-random/rand_core"
88
documentation = "https://docs.rs/rand_core"
99
homepage = "https://rust-random.github.io/book"
10-
description = """
11-
Core random number generator traits and tools for implementation.
12-
"""
10+
description = "Core random number generation traits and tools for implementation."
1311
keywords = ["random", "rng"]
1412
categories = ["algorithms", "no-std"]
1513
edition = "2024"

README.md

Lines changed: 30 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,41 @@
1-
# rand_core
1+
# rand_core: core random number generation traits
22

3-
[![Test Status](https://github.com/rust-random/rand_core/actions/workflows/test.yml/badge.svg?event=push)](https://github.com/rust-random/rand_core/actions)
4-
[![Latest version](https://img.shields.io/crates/v/rand_core.svg)](https://crates.io/crates/rand_core)
5-
[![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/)
6-
[![API](https://docs.rs/rand_core/badge.svg)](https://docs.rs/rand_core)
3+
<div class="badges">
4+
5+
[![crate][crate-badge]][crate-link]
6+
[![Docs][docs-image]][docs-link]
7+
[![Apache2/MIT licensed][license-image]][license-link]
8+
[![Build Status][build-image]][build-link]
79

8-
Core traits and error types of the [rand] library, plus tools for implementing
9-
RNGs.
10+
</div>
1011

11-
This crate is intended for use when implementing the core trait, `RngCore`; it
12-
defines the core traits to be implemented as well as several small functions to
13-
aid in their implementation and types required for error handling.
12+
This crate provides a collection of traits used by implementations of Random Number Generation (RNG)
13+
algorithms. Additionally, it includes helper utilities that assist with the implementation
14+
of these traits.
1415

15-
The main [rand] crate re-exports most items defined in this crate, along with
16-
tools to convert the integer samples generated by `RngCore` to many different
17-
applications (including sampling from restricted ranges, conversion to floating
18-
point, list permutations and secure initialisation of RNGs). Most users should
19-
prefer to use the main [rand] crate.
16+
Note that the traits focus solely on the core RNG functionality. Most users should prefer
17+
the [`rand`] crate, which offers more advanced RNG capabilities built on these core traits,
18+
such as sampling from restricted ranges, generating floating-point numbers, list permutations,
19+
and more.
2020

21-
Links:
21+
[`rand`]: https://docs.rs/rand
2222

23-
- [API documentation (docs.rs)](https://docs.rs/rand_core)
24-
- [Changelog](https://github.com/rust-random/rand_core/blob/master/CHANGELOG.md)
23+
## License
2524

26-
[rand]: https://crates.io/crates/rand
25+
The crate is licensed under either of:
2726

27+
* [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
28+
* [MIT license](http://opensource.org/licenses/MIT)
2829

29-
## Functionality
30+
at your option.
3031

31-
The `rand_core` crate provides:
32+
[//]: # (badges)
3233

33-
- base random number generator traits
34-
- error-reporting types
35-
- functionality to aid implementation of RNGs
36-
37-
The traits and error types are also available via `rand`.
38-
39-
## Versions
40-
41-
The current version is:
42-
43-
```toml
44-
rand_core = "0.9.3"
45-
```
46-
47-
48-
# License
49-
50-
`rand_core` is distributed under the terms of both the MIT license and the
51-
Apache License (Version 2.0).
52-
53-
See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT), and
54-
[COPYRIGHT](COPYRIGHT) for details.
34+
[crate-badge]: https://img.shields.io/crates/v/rand_core.svg
35+
[crate-link]: https://crates.io/crates/rand_core
36+
[docs-image]: https://docs.rs/rand_core/badge.svg
37+
[docs-link]: https://docs.rs/rand_core
38+
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
39+
[build-image]: https://github.com/rust-random/rand_core/actions/workflows/test.yml/badge.svg?branch=master
40+
[license-link]: #license
41+
[build-link]: https://github.com/rust-random/rand_core/actions/workflows/test.yml?query=branch:master

src/lib.rs

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,19 @@
1-
//! Random number generation traits
2-
//!
3-
//! This crate is mainly of interest to crates publishing implementations of
4-
//! [`RngCore`]. Other users are encouraged to use the [`rand`] crate instead
5-
//! which re-exports the main traits and error types.
6-
//!
7-
//! [`RngCore`] is the core trait implemented by algorithmic pseudo-random number
8-
//! generators and external random-number sources.
9-
//!
10-
//! [`SeedableRng`] is an extension trait for construction from fixed seeds and
11-
//! other random number generators.
12-
//!
13-
//! The [`le`] sub-module includes a few small functions to assist
14-
//! implementation of [`RngCore`] and [`SeedableRng`].
15-
//!
16-
//! [`rand`]: https://docs.rs/rand
1+
// Hide badges from generated docs
2+
//! <style> .badges { display: none; } </style>
173
4+
#![no_std]
5+
#![doc = include_str!("../README.md")]
186
#![doc(
197
html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
208
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
219
html_root_url = "https://rust-random.github.io/rand/"
2210
)]
23-
#![deny(missing_docs)]
24-
#![deny(missing_debug_implementations)]
25-
#![deny(clippy::undocumented_unsafe_blocks)]
26-
#![doc(test(attr(allow(unused_variables), deny(warnings))))]
2711
#![cfg_attr(docsrs, feature(doc_cfg))]
28-
#![no_std]
12+
#![deny(
13+
missing_docs,
14+
missing_debug_implementations,
15+
clippy::undocumented_unsafe_blocks
16+
)]
2917

3018
use core::{fmt, ops::DerefMut};
3119

0 commit comments

Comments
 (0)