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:
parent
ac849f1fd5
commit
63ffdcd467
|
|
@ -33,7 +33,7 @@ impl<T, const N: usize> BoundedVec<T, N> {
|
||||||
/// assert_eq!(bounded.len(), 3);
|
/// assert_eq!(bounded.len(), 3);
|
||||||
/// assert_eq!(iter.count(), 1);
|
/// 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 {
|
BoundedVec {
|
||||||
v: iter.into_iter().take(N).collect(),
|
v: iter.into_iter().take(N).collect(),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue