From 42f366b2aa82adedd1a3b233a53bb0aa5c7f3ce6 Mon Sep 17 00:00:00 2001 From: Taylor Bockman Date: Sun, 10 Dec 2017 23:27:44 -0800 Subject: [PATCH] lol --- src/lib.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ad0cc8a..44b302c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,11 +4,14 @@ mod commands; +use std::fmt; + +#[derive(Debug)] pub struct Engine<'a, R, W> { pub name: &'a str, pub author: &'a str, - pub mut reader: R, - pub mut writer: W, + pub reader: R, + pub writer: W, } /// Notes to delete later: @@ -42,9 +45,9 @@ impl<'a> Engine<'a, R, W> { /// Sends identification messages to the writer for the GUI to pick up /// TODO: Write tests for this. Reference: /// https://stackoverflow.com/questions/28370126/how-can-i-test-stdin-and-stdout - pub fn identify(&self) { - let name_id: String = fmt!("{} {} {}", constants::ID, constants::NAME, self.name); - let author_id: String = fmt!("{} {} {}", constants::ID, constants::AUTHOR, self.author); + pub fn identify(&mut self) { + let name_id: String = format!("{} {} {}", commands::ID, commands::NAME, self.name); + let author_id: String = format!("{} {} {}", commands::ID, commands::AUTHOR, self.author); // For these two writes we can panic - there's no possibility of recovery if the engine fails at this stage write!(&mut self.writer, "{}", name_id).expect("failed to send name identification to writer");