mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-25 16:12:06 +01:00
18 lines
412 B
Rust
18 lines
412 B
Rust
pub(crate) struct Unzip<A, B>(pub A, pub B);
|
|
|
|
impl<A, B, T, U> FromIterator<(T, U)> for Unzip<A, B>
|
|
where
|
|
A: Default + Extend<T>,
|
|
B: Default + Extend<U>,
|
|
{
|
|
fn from_iter<I: IntoIterator<Item = (T, U)>>(iter: I) -> Self {
|
|
let (mut a, mut b): (A, B) = Default::default();
|
|
|
|
for (t, u) in iter {
|
|
a.extend([t]);
|
|
b.extend([u]);
|
|
}
|
|
|
|
Unzip(a, b)
|
|
}
|
|
}
|