From b53033b15dda82fee7c497ded3cafe643593d091 Mon Sep 17 00:00:00 2001 From: Wesley Moore Date: Sat, 7 Dec 2019 17:25:55 +1100 Subject: [PATCH] Rename Memory to Computer --- 2019/src/bin/day5.rs | 2 +- 2019/src/computer.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/2019/src/bin/day5.rs b/2019/src/bin/day5.rs index d3f4b9e..f1cc73a 100644 --- a/2019/src/bin/day5.rs +++ b/2019/src/bin/day5.rs @@ -4,7 +4,7 @@ use std::{fs, io}; fn main() -> io::Result<()> { let input = fs::read_to_string("input/day5.txt")?; let mut data = input::read_separated_line(',', &input)?; - let mut program = computer::Memory::new(&mut data); + let mut program = computer::Computer::new(&mut data); program.run(None, None); diff --git a/2019/src/computer.rs b/2019/src/computer.rs index 7994982..e76523c 100644 --- a/2019/src/computer.rs +++ b/2019/src/computer.rs @@ -23,7 +23,7 @@ enum Mode { Address, } -pub struct Memory<'a> { +pub struct Computer<'a> { mem: &'a mut [i32], } @@ -66,9 +66,9 @@ fn decode(mut instruction: i32) -> Instruction { } } -impl<'a> Memory<'a> { +impl<'a> Computer<'a> { pub fn new(mem: &'a mut [i32]) -> Self { - Memory { mem } + Computer { mem } } fn read(&self, value: i32, mode: Mode) -> i32 { @@ -191,7 +191,7 @@ mod tests { fn test_day2() { let input = fs::read_to_string("input/day2.txt").unwrap(); let mut data = input::read_separated_line(',', &input).unwrap(); - let mut program = Memory::new(&mut data); + let mut program = Computer::new(&mut data); // Check that day2 still works wirh run through this implementation program.run(Some(12), Some(2));