Refactoring not done yet, still need to do RSassert

This commit is contained in:
elvis
2025-08-24 02:01:24 +02:00
parent 8a492c7b8a
commit 3a4c4d43c2
18 changed files with 705 additions and 747 deletions

View File

@ -1,7 +1,8 @@
use std::rc::Rc;
use super::set::Set;
use super::process::Process;
use super::set::Set;
use super::translator::{Translator, PrintableWithTranslator, Formatter};
#[derive(Clone, Debug)]
pub struct Choices {
@ -98,3 +99,29 @@ impl From<Vec<(Rc<Set>, Rc<Process>)>> for Choices {
Choices { context_moves: arr }
}
}
impl PrintableWithTranslator for Choices {
fn print(&self, f: &mut std::fmt::Formatter, translator: &Translator)
-> std::fmt::Result {
write!(f, "[")?;
let mut it = self.iter().peekable();
while let Some(el) = it.next() {
if it.peek().is_none() {
write!(
f,
"[set: {}, process: {}]",
Formatter::from(translator, &*el.0),
Formatter::from(translator, &*el.1)
)?;
} else {
write!(
f,
"[set: {}, process: {}], ",
Formatter::from(translator, &*el.0),
Formatter::from(translator, &*el.1)
)?;
}
}
write!(f, "]")
}
}