Implemented fmt::Binary.

This commit is contained in:
Rhinemann 2023-06-26 00:43:51 +03:00
parent c730e0d1bd
commit 31143cac1d
1 changed files with 12 additions and 0 deletions

View File

@ -68,6 +68,18 @@ impl fmt::Display for BasicRegister {
}
}
impl fmt::Binary for BasicRegister {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "Memory: ")?;
for v in self.memory.iter() {
write!(f, "{}", *v as u8)?;
}
write!(f, "")
}
}
fn read_vec(variable_name: &str) -> Vec<char> {
loop {
print!("Enter {variable_name}: ");