1
2
3
4
5
6
7
8
9
10
11
12
13
// Copyright (C) 2020 Stephane Raux. Distributed under the MIT license.

use crate::{Block, BlockProducer, Environment};
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct Sequence(pub Vec<BlockProducer>);

impl Sequence {
    pub fn produce(&self, environment: &Environment) -> Vec<Block> {
        self.0.iter().flat_map(|p| p.produce(environment)).collect()
    }
}