use crate::*;
impl<'a> Default for Task<'a> {
#[inline(always)]
fn default() -> Self {
Self { text_list: vec![] }
}
}
impl<'a> Task<'a> {
#[inline(always)]
pub(crate) fn add(&mut self, new_text: Text<'a>) -> &mut Self {
self.text_list.push(new_text);
self
}
#[inline(always)]
pub(crate) fn clear(&mut self) -> &mut Self {
self.text_list.clear();
self
}
pub(crate) fn run_all(&mut self) -> &mut Self {
let text_list: Vec<Text<'_>> = self.text_list.clone();
self.clear();
let mut output_str: String = String::with_capacity(text_list.len());
for text in text_list.iter() {
output_str.push_str(&Text::new_from(text).get_display_str_cow());
}
print!("{output_str}");
std::io::stdout().flush().unwrap();
self
}
}