File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
The format is based on [ Keep a Changelog] ( http://keepachangelog.com/en/1.0.0/ )
5
5
and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
6
6
7
+ ## Unreleased
8
+ ### API changes
9
+ - Relax ` Sized ` bound on impls of ` SeedableRng ` (#1641 )
10
+
7
11
## [ 0.9.3] — 2025-02-29
8
12
### Other
9
13
- Remove ` zerocopy ` dependency (#1607 )
Original file line number Diff line number Diff line change @@ -248,12 +248,12 @@ impl<R: BlockRngCore + SeedableRng> SeedableRng for BlockRng<R> {
248
248
}
249
249
250
250
#[ inline( always) ]
251
- fn from_rng ( rng : & mut impl RngCore ) -> Self {
251
+ fn from_rng < S : RngCore + ? Sized > ( rng : & mut S ) -> Self {
252
252
Self :: new ( R :: from_rng ( rng) )
253
253
}
254
254
255
255
#[ inline( always) ]
256
- fn try_from_rng < S : TryRngCore > ( rng : & mut S ) -> Result < Self , S :: Error > {
256
+ fn try_from_rng < S : TryRngCore + ? Sized > ( rng : & mut S ) -> Result < Self , S :: Error > {
257
257
R :: try_from_rng ( rng) . map ( Self :: new)
258
258
}
259
259
}
@@ -411,12 +411,12 @@ impl<R: BlockRngCore + SeedableRng> SeedableRng for BlockRng64<R> {
411
411
}
412
412
413
413
#[ inline( always) ]
414
- fn from_rng ( rng : & mut impl RngCore ) -> Self {
414
+ fn from_rng < S : RngCore + ? Sized > ( rng : & mut S ) -> Self {
415
415
Self :: new ( R :: from_rng ( rng) )
416
416
}
417
417
418
418
#[ inline( always) ]
419
- fn try_from_rng < S : TryRngCore > ( rng : & mut S ) -> Result < Self , S :: Error > {
419
+ fn try_from_rng < S : TryRngCore + ? Sized > ( rng : & mut S ) -> Result < Self , S :: Error > {
420
420
R :: try_from_rng ( rng) . map ( Self :: new)
421
421
}
422
422
}
Original file line number Diff line number Diff line change @@ -519,7 +519,7 @@ pub trait SeedableRng: Sized {
519
519
/// (in prior versions this was not required).
520
520
///
521
521
/// [`rand`]: https://docs.rs/rand
522
- fn from_rng ( rng : & mut impl RngCore ) -> Self {
522
+ fn from_rng < R : RngCore + ? Sized > ( rng : & mut R ) -> Self {
523
523
let mut seed = Self :: Seed :: default ( ) ;
524
524
rng. fill_bytes ( seed. as_mut ( ) ) ;
525
525
Self :: from_seed ( seed)
@@ -528,7 +528,7 @@ pub trait SeedableRng: Sized {
528
528
/// Create a new PRNG seeded from a potentially fallible `Rng`.
529
529
///
530
530
/// See [`from_rng`][SeedableRng::from_rng] docs for more information.
531
- fn try_from_rng < R : TryRngCore > ( rng : & mut R ) -> Result < Self , R :: Error > {
531
+ fn try_from_rng < R : TryRngCore + ? Sized > ( rng : & mut R ) -> Result < Self , R :: Error > {
532
532
let mut seed = Self :: Seed :: default ( ) ;
533
533
rng. try_fill_bytes ( seed. as_mut ( ) ) ?;
534
534
Ok ( Self :: from_seed ( seed) )
You can’t perform that action at this time.
0 commit comments