use crate::{aictable::Aictable, factory::Factory};
pub struct FactoryBuilder<T: Aictable> {
initial_value: T,
looping: bool,
rewind: bool,
}
impl<T: Aictable> Default for FactoryBuilder<T> {
fn default() -> Self {
Self {
initial_value: T::INITIAL,
looping: false,
rewind: false,
}
}
}
impl<T: Aictable> FactoryBuilder<T> {
pub fn new() -> Self {
Self::default()
}
pub fn initial_value(mut self, initial_value: T) -> Self {
self.initial_value = initial_value;
self
}
pub fn looping(mut self, looping: bool) -> Self {
self.looping = looping;
self
}
pub fn rewind(mut self, rewind: bool) -> Self {
self.rewind = rewind;
self
}
pub fn build(self) -> Factory<T> {
Factory::new(self.initial_value, self.looping, self.rewind)
}
}