ethers_solc/compile/
many.rs1use crate::{error::Result, CompilerInput, CompilerOutput, Solc};
2
3type CompileElement = (Result<CompilerOutput>, Solc, CompilerInput);
5
6#[derive(Debug)]
8pub struct CompiledMany {
9 outputs: Vec<CompileElement>,
10}
11
12impl CompiledMany {
13 pub fn new(outputs: Vec<CompileElement>) -> Self {
14 Self { outputs }
15 }
16
17 pub fn outputs(&self) -> impl Iterator<Item = &CompileElement> {
19 self.outputs.iter()
20 }
21
22 pub fn into_outputs(self) -> impl Iterator<Item = CompileElement> {
24 self.outputs.into_iter()
25 }
26
27 pub fn flattened(self) -> Result<Vec<CompilerOutput>> {
29 self.into_iter().collect()
30 }
31}
32
33impl IntoIterator for CompiledMany {
34 type Item = Result<CompilerOutput>;
35 type IntoIter = std::vec::IntoIter<Result<CompilerOutput>>;
36
37 fn into_iter(self) -> Self::IntoIter {
38 self.outputs.into_iter().map(|(res, _, _)| res).collect::<Vec<_>>().into_iter()
39 }
40}