1use super::Repl;
2use crate::LangInterface;
3
4pub struct ReplIter<L: LangInterface> {
9 repl: Repl<L>,
10 color: crate::Color,
11}
12
13impl<L: LangInterface> ReplIter<L> {
14 pub fn new(repl: Repl<L>, color: crate::Color) -> Self {
16 Self { repl, color }
17 }
18
19 pub fn set_exit_keyword(&mut self, exit_keyword: &'static str) {
21 self.repl.set_exit_keyword(exit_keyword)
22 }
23
24 pub fn set_clear_keyword(&mut self, clear_keyword: &'static str) {
26 self.repl.set_clear_keyword(clear_keyword)
27 }
28}
29
30impl<L: LangInterface> Repl<L> {
31 pub fn iter(self, color: crate::Color) -> ReplIter<L> {
33 ReplIter::new(self, color)
34 }
35}
36
37impl<L: LangInterface> Iterator for ReplIter<L> {
38 type Item = String;
39
40 fn next(&mut self) -> Option<Self::Item> {
41 self.repl.next(self.color).ok()
42 }
43}