use crate::ExePlay;
pub trait IntoExePlaySequential {
fn into_exe_play_sequential(self) -> ExePlay;
}
impl<I: IntoIterator<Item = ExePlay>> IntoExePlaySequential for I {
fn into_exe_play_sequential(self) -> ExePlay {
ExePlay::Sequential(self.into_iter().collect())
}
}
#[cfg(test)]
mod test_into_exe_play_sequential {
use super::*;
use crate::utils::test::*;
#[test]
fn test_into_exe_play_sequential() {
let plays = [
create_play_helper("sample1").into(),
create_play_helper("sample2").into(),
create_play_helper("sample3").into(),
];
match plays.into_exe_play_sequential() {
ExePlay::Sequential(_) => {
}
_ => unreachable!("exe_play should be ExeSequential"),
}
}
}
pub trait IntoExePlayParallel {
fn into_exe_play_parallel(self) -> ExePlay;
}
impl<I: IntoIterator<Item = ExePlay>> IntoExePlayParallel for I {
fn into_exe_play_parallel(self) -> ExePlay {
ExePlay::Parallel(self.into_iter().collect())
}
}
#[cfg(test)]
mod test_into_exe_play_parallel {
use super::*;
use crate::utils::test::*;
#[test]
fn test_into_exe_play_parallel() {
let plays = [
create_play_helper("sample1").into(),
create_play_helper("sample2").into(),
create_play_helper("sample3").into(),
];
match plays.into_exe_play_parallel() {
ExePlay::Parallel(_) => {
}
_ => unreachable!("exe_play should be ExeParallel"),
}
}
}