protocol: IntoIterator for BoundedVec
Implement `IntoIterator` for the `BoundedVec`. This allows the use of `into_iter` for returning the owned data, rather than references via the `Deref` implementation.
This commit is contained in:
parent
37d4ae4a9f
commit
c675683da9
|
|
@ -180,6 +180,15 @@ impl<T: Clone, const N: usize> BoundedVec<T, N> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T, const N: usize> IntoIterator for BoundedVec<T, N> {
|
||||
type Item = T;
|
||||
type IntoIter = std::vec::IntoIter<T>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
self.v.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, const N: usize> ops::Deref for BoundedVec<T, N> {
|
||||
type Target = [T];
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue