Skip to content

Commit

Permalink
Add explanations of cross-version crate compatibility to README
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Apr 18, 2019
1 parent adbfa38 commit 33002ec
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ To get started using Rand, see [The Book](https://rust-random.github.io/book).

## Versions

Rand libs have inter-dependencies and make use of the
[semver trick](https://github.com/dtolnay/semver-trick/) in order to make traits
compatible across crate versions. (This is especially important for `RngCore`
and `SeedableRng`.) A few crate releases are thus compatibility shims,
depending on the *next* lib version (e.g. `rand_core` versions `0.2.2` and
`0.3.1`). This means, for example, that `rand_core_0_4_0::SeedableRng` and
`rand_core_0_3_0::SeedableRng` are distinct, incompatible traits, which can
cause build errors. Usually, running `cargo update` is enough to fix any issues.

The Rand lib is not yet stable, however we are careful to limit breaking changes
and warn via deprecation wherever possible. Patch versions never introduce
breaking changes. The following minor versions are supported:
Expand Down
11 changes: 11 additions & 0 deletions rand_core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ The `rand_core` crate provides:

The traits and error types are also available via `rand`.

## Versions

Rand libs have inter-dependencies and make use of the
[semver trick](https://github.com/dtolnay/semver-trick/) in order to make traits
compatible across crate versions. (This is especially important for `RngCore`
and `SeedableRng`.) A few crate releases are thus compatibility shims,
depending on the *next* lib version (e.g. `rand_core` versions `0.2.2` and
`0.3.1`). This means, for example, that `rand_core_0_4_0::SeedableRng` and
`rand_core_0_3_0::SeedableRng` are distinct, incompatible traits, which can
cause build errors. Usually, running `cargo update` is enough to fix any issues.

## Crate Features

`rand_core` supports `no_std` and `alloc`-only configurations, as well as full
Expand Down

0 comments on commit 33002ec

Please sign in to comment.