From f5a4e92ffe76aa1a78dbfe82c47f0393597ce969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Mon, 10 Nov 2025 16:24:45 +0300 Subject: [PATCH 1/3] Switch to `#![doc = include_str!("../README.md")]` --- README.md | 74 +++++++++++++++++++++++------------------------------- src/lib.rs | 29 ++++++--------------- 2 files changed, 39 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index 1a6546eb..e44db962 100644 --- a/README.md +++ b/README.md @@ -1,54 +1,44 @@ -# rand_core +# rand_core: core random number generation traits -[![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) -[![Latest version](https://img.shields.io/crates/v/rand_core.svg)](https://crates.io/crates/rand_core) -[![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) -[![API](https://docs.rs/rand_core/badge.svg)](https://docs.rs/rand_core) +[![crate][crate-image]][crate-link] +[![Docs][docs-image]][docs-link] +![Apache2/MIT licensed][license-image] +![Rust Version][rustc-image] +[![Build Status][build-image]][build-link] -Core traits and error types of the [rand] library, plus tools for implementing -RNGs. +This crate provides a collection of traits used by implementations of Random Number Generation (RNG) +algorithms. Additionally, it includes helper utilities that assist with the implementation +of these traits. -This crate is intended for use when implementing the core trait, `RngCore`; it -defines the core traits to be implemented as well as several small functions to -aid in their implementation and types required for error handling. +Note that the traits focus solely on the core RNG functionality. Most users should prefer +the [`rand`] crate, which offers more advanced RNG capabilities built on these core traits, +such as sampling from restricted ranges, generating floating-point numbers, list permutations, +and more. -The main [rand] crate re-exports most items defined in this crate, along with -tools to convert the integer samples generated by `RngCore` to many different -applications (including sampling from restricted ranges, conversion to floating -point, list permutations and secure initialisation of RNGs). Most users should -prefer to use the main [rand] crate. +[`rand`]: https://docs.rs/rand -Links: +## License -- [API documentation (docs.rs)](https://docs.rs/rand_core) -- [Changelog](https://github.com/rust-random/rand_core/blob/master/CHANGELOG.md) +The crate is licensed under either of: -[rand]: https://crates.io/crates/rand +* [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) +* [MIT license](http://opensource.org/licenses/MIT) +at your option. -## Functionality +### Contribution -The `rand_core` crate provides: +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in the work by you, as defined in the Apache-2.0 license, shall be +dual licensed as above, without any additional terms or conditions. -- base random number generator traits -- error-reporting types -- functionality to aid implementation of RNGs +[//]: # (badges) -The traits and error types are also available via `rand`. - -## Versions - -The current version is: - -```toml -rand_core = "0.9.3" -``` - - -# License - -`rand_core` is distributed under the terms of both the MIT license and the -Apache License (Version 2.0). - -See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT), and -[COPYRIGHT](COPYRIGHT) for details. +[crate-image]: https://img.shields.io/crates/v/rand_core.svg +[crate-link]: https://crates.io/crates/rand_core +[docs-image]: https://docs.rs/rand_core/badge.svg +[docs-link]: https://docs.rs/rand_core +[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg +[rustc-image]: https://img.shields.io/badge/rustc-1.85+-blue.svg +[build-image]: https://github.com/rust-random/rand_core/actions/workflows/test.yml/badge.svg?branch=master +[build-link]: https://github.com/rust-random/rand_core/actions/workflows/test.yml?query=branch:master diff --git a/src/lib.rs b/src/lib.rs index 13d53628..7d4a320d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,34 +7,19 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! Random number generation traits -//! -//! This crate is mainly of interest to crates publishing implementations of -//! [`RngCore`]. Other users are encouraged to use the [`rand`] crate instead -//! which re-exports the main traits and error types. -//! -//! [`RngCore`] is the core trait implemented by algorithmic pseudo-random number -//! generators and external random-number sources. -//! -//! [`SeedableRng`] is an extension trait for construction from fixed seeds and -//! other random number generators. -//! -//! The [`le`] sub-module includes a few small functions to assist -//! implementation of [`RngCore`] and [`SeedableRng`]. -//! -//! [`rand`]: https://docs.rs/rand - +#![no_std] +#![doc = include_str!("../README.md")] #![doc( html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png", html_favicon_url = "https://www.rust-lang.org/favicon.ico", html_root_url = "https://rust-random.github.io/rand/" )] -#![deny(missing_docs)] -#![deny(missing_debug_implementations)] -#![deny(clippy::undocumented_unsafe_blocks)] -#![doc(test(attr(allow(unused_variables), deny(warnings))))] #![cfg_attr(docsrs, feature(doc_cfg))] -#![no_std] +#![deny( + missing_docs, + missing_debug_implementations, + clippy::undocumented_unsafe_blocks +)] use core::{fmt, ops::DerefMut}; From bfaa938a6cecd5a9069fab9eb667e361e7523276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Mon, 10 Nov 2025 20:31:17 +0300 Subject: [PATCH 2/3] remove contribution section --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index e44db962..c092b7bf 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,6 @@ The crate is licensed under either of: at your option. -### Contribution - -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in the work by you, as defined in the Apache-2.0 license, shall be -dual licensed as above, without any additional terms or conditions. - [//]: # (badges) [crate-image]: https://img.shields.io/crates/v/rand_core.svg From 5975bc7b9c8243fababb03ff205d2d783f33b93e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Mon, 10 Nov 2025 20:35:00 +0300 Subject: [PATCH 3/3] tweak description --- Cargo.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3f979cc7..dac035a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,9 +7,7 @@ readme = "README.md" repository = "https://github.com/rust-random/rand_core" documentation = "https://docs.rs/rand_core" homepage = "https://rust-random.github.io/book" -description = """ -Core random number generator traits and tools for implementation. -""" +description = "Core random number generation traits and tools for implementation." keywords = ["random", "rng"] categories = ["algorithms", "no-std"] edition = "2024"