Skip to content

Commit

Permalink
Relax Sized bounds of sample_iter functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Feb 6, 2019
1 parent 4ca5ee3 commit e07f8ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/distributions/mod.rs
Expand Up @@ -259,7 +259,7 @@ pub trait Distribution<T> {
/// }
/// ```
fn sample_iter<'a, R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T>
where Self: Sized, R: Rng
where R: Rng + ?Sized
{
DistIter {
distr: self,
Expand All @@ -284,7 +284,7 @@ impl<'a, T, D: Distribution<T>> Distribution<T> for &'a D {
///
/// [`sample_iter`]: Distribution::sample_iter
#[derive(Debug)]
pub struct DistIter<'a, D: 'a, R: 'a, T> {
pub struct DistIter<'a, D: 'a + ?Sized, R: 'a + ?Sized, T> {
distr: &'a D,
rng: &'a mut R,
phantom: ::core::marker::PhantomData<T>,
Expand Down
5 changes: 3 additions & 2 deletions src/lib.rs
Expand Up @@ -290,8 +290,9 @@ pub trait Rng: RngCore {
/// println!("Not a 6; rolling again!");
/// }
/// ```
fn sample_iter<'a, T, D: Distribution<T>>(&'a mut self, distr: &'a D)
-> distributions::DistIter<'a, D, Self, T> where Self: Sized
fn sample_iter<'a, T, D>(&'a mut self, distr: &'a D)
-> distributions::DistIter<'a, D, Self, T>
where D: Distribution<T> + ?Sized
{
distr.sample_iter(self)
}
Expand Down

0 comments on commit e07f8ec

Please sign in to comment.