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-17 16:09:42 +01:00
committed by cloudhead
parent ac849f1fd5
commit 63ffdcd467
+1 -1
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(),
}