use crate::{error::Result, CompilerInput, CompilerOutput, Solc};
type CompileElement = (Result<CompilerOutput>, Solc, CompilerInput);
#[derive(Debug)]
pub struct CompiledMany {
    outputs: Vec<CompileElement>,
}
impl CompiledMany {
    pub fn new(outputs: Vec<CompileElement>) -> Self {
        Self { outputs }
    }
    pub fn outputs(&self) -> impl Iterator<Item = &CompileElement> {
        self.outputs.iter()
    }
    pub fn into_outputs(self) -> impl Iterator<Item = CompileElement> {
        self.outputs.into_iter()
    }
    pub fn flattened(self) -> Result<Vec<CompilerOutput>> {
        self.into_iter().collect()
    }
}
impl IntoIterator for CompiledMany {
    type Item = Result<CompilerOutput>;
    type IntoIter = std::vec::IntoIter<Result<CompilerOutput>>;
    fn into_iter(self) -> Self::IntoIter {
        self.outputs.into_iter().map(|(res, _, _)| res).collect::<Vec<_>>().into_iter()
    }
}