node: loosen BoundedVec::collect_from bounds

The bounds on `collect_from` were overly restrictive. Allow any
`IntoIterator` be used as an argument, while taking ownership, rather
mutably borrowed.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
Fintan Halpenny 2023-11-10 11:09:44 +00:00 committed by cloudhead
parent ac849f1fd5
commit 63ffdcd467
No known key found for this signature in database
1 changed files with 1 additions and 1 deletions

View File

@ -33,7 +33,7 @@ impl<T, const N: usize> BoundedVec<T, N> {
/// assert_eq!(bounded.len(), 3);
/// assert_eq!(iter.count(), 1);
/// ```
pub fn collect_from<I: Iterator<Item = T>>(iter: &mut I) -> Self {
pub fn collect_from<I: IntoIterator<Item = T>>(iter: I) -> Self {
BoundedVec {
v: iter.into_iter().take(N).collect(),
}