Skip to content

Commit

Permalink
Generalize bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
matklad authored and nagisa committed Jul 4, 2024
1 parent f734da9 commit 74122c8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/unstructured.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,12 @@ impl<'a> Unstructured<'a> {
///
/// println!("chose {}", choice);
/// ```
pub fn choose_iter<T, I>(&mut self, mut choices: I) -> Result<T>
pub fn choose_iter<T, I>(&mut self, choices: I) -> Result<T>
where
I: ExactSizeIterator<Item = T>,
I: IntoIterator<Item = T>,
I::IntoIter: ExactSizeIterator,
{
let mut choices = choices.into_iter();
let idx = self.choose_index(choices.len())?;
let choice = choices
.nth(idx)
Expand Down

0 comments on commit 74122c8

Please sign in to comment.