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.
44The format is based on [ Keep a Changelog] ( http://keepachangelog.com/en/1.0.0/ )
55and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
66
7+ ## Unreleased
8+ ### API changes
9+ - Relax ` Sized ` bound on impls of ` SeedableRng ` (#1641 )
10+
711## [ 0.9.3] — 2025-02-29
812### Other
913- 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> {
248248 }
249249
250250 #[ inline( always) ]
251- fn from_rng ( rng : & mut impl RngCore ) -> Self {
251+ fn from_rng < S : RngCore + ? Sized > ( rng : & mut S ) -> Self {
252252 Self :: new ( R :: from_rng ( rng) )
253253 }
254254
255255 #[ 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 > {
257257 R :: try_from_rng ( rng) . map ( Self :: new)
258258 }
259259}
@@ -411,12 +411,12 @@ impl<R: BlockRngCore + SeedableRng> SeedableRng for BlockRng64<R> {
411411 }
412412
413413 #[ inline( always) ]
414- fn from_rng ( rng : & mut impl RngCore ) -> Self {
414+ fn from_rng < S : RngCore + ? Sized > ( rng : & mut S ) -> Self {
415415 Self :: new ( R :: from_rng ( rng) )
416416 }
417417
418418 #[ 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 > {
420420 R :: try_from_rng ( rng) . map ( Self :: new)
421421 }
422422}
Original file line number Diff line number Diff line change @@ -519,7 +519,7 @@ pub trait SeedableRng: Sized {
519519 /// (in prior versions this was not required).
520520 ///
521521 /// [`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 {
523523 let mut seed = Self :: Seed :: default ( ) ;
524524 rng. fill_bytes ( seed. as_mut ( ) ) ;
525525 Self :: from_seed ( seed)
@@ -528,7 +528,7 @@ pub trait SeedableRng: Sized {
528528 /// Create a new PRNG seeded from a potentially fallible `Rng`.
529529 ///
530530 /// 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 > {
532532 let mut seed = Self :: Seed :: default ( ) ;
533533 rng. try_fill_bytes ( seed. as_mut ( ) ) ?;
534534 Ok ( Self :: from_seed ( seed) )
You can’t perform that action at this time.
0 commit comments