Impl IntoIterator for &Targets

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-07 12:10:05 +10:00
parent bd224f7186
commit 1d71f92ee6
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -3,6 +3,7 @@ use std::io::{BufRead, Cursor};
use std::iter::IntoIterator;
use std::ops::Deref;
use std::process::Output;
use std::slice;
use tokio::process::Command;
/// Compiled target triple, used as default for binary fetching
@ -44,6 +45,15 @@ impl IntoIterator for Targets {
}
}
impl<'a> IntoIterator for &'a Targets {
type Item = &'a Box<str>;
type IntoIter = slice::Iter<'a, Box<str>>;
fn into_iter(self) -> Self::IntoIter {
(&self.0).into_iter()
}
}
/// Detect the targets supported at runtime,
/// which might be different from `TARGET` which is detected
/// at compile-time.