summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2020-01-13 23:08:19 +0200
committerJustin Wernick <justin@worthe-it.co.za>2020-01-13 23:08:19 +0200
commitfa3b0d8cb573a2a0700fa565d6cf12abf66dc70f (patch)
tree773f4f85edd2eba1dd3729d0f55e0f00b42f04eb /src/lib.rs
parent87572a858c724f1c7414743ad397e79101c46727 (diff)
Day 25: Text adventure game!
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 5df59f4..7a14d3c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -125,6 +125,13 @@ impl IntcodeProgram {
.unwrap()
}
+ pub fn output_into_result(&self) -> Result<Vector<Intcode>, IntcodeProgramError> {
+ match self.error {
+ Some(ref error) => Err(error.clone()),
+ None => Ok(self.output.clone()),
+ }
+ }
+
fn with_instruction_pointer(&self, instruction_pointer: Intcode) -> IntcodeProgram {
IntcodeProgram {
instruction_pointer,
@@ -170,13 +177,6 @@ impl IntcodeProgram {
}
}
- fn output_into_result(&self) -> Result<Vector<Intcode>, IntcodeProgramError> {
- match self.error {
- Some(ref error) => Err(error.clone()),
- None => Ok(self.output.clone()),
- }
- }
-
fn memory_0_into_result(&self) -> Result<Intcode, IntcodeProgramError> {
match self.error {
Some(ref error) => Err(error.clone()),