Browse Source

fix flaw

ag-yep
Taylor Bockman 7 years ago
parent
commit
3e2fbfa216
  1. 11
      src/lib.rs

11
src/lib.rs

@ -4,7 +4,6 @@
mod commands; mod commands;
use std::fmt;
#[derive(Debug)] #[derive(Debug)]
pub struct Engine<'a, R, W> { pub struct Engine<'a, R, W> {
@ -32,8 +31,8 @@ pub struct Engine<'a, R, W> {
/// Additionally this code should have a parser. You call it with the reader supplied and it waits for a command /// Additionally this code should have a parser. You call it with the reader supplied and it waits for a command
/// and parses it into a tuple of some kind for the user. /// and parses it into a tuple of some kind for the user.
impl<'a> Engine<'a, R, W> { impl<'a, R, W> Engine<'a, R, W> {
pub fn new(name: &'a str, author: &'a str, reader: R, writer: W) -> Engine<'a> { pub fn new(name: &'a str, author: &'a str, reader: R, writer: W) -> Engine<'a, R, W> {
// TODO: This should also take an EngineOptions thing that indicates which options are supported // TODO: This should also take an EngineOptions thing that indicates which options are supported
// so that when called it can send them easily. // so that when called it can send them easily.
@ -41,14 +40,12 @@ impl<'a> Engine<'a, R, W> {
Engine { Engine {
name: name, name: name,
author: author, author: author,
reader: R, reader: reader,
writer: W, writer: writer,
} }
} }
/// Sends identification messages to the writer for the GUI to pick up /// 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(&mut self) { pub fn identify(&mut self) {
let name_id: String = format!("{} {} {}", commands::ID, commands::NAME, self.name); let name_id: String = format!("{} {} {}", commands::ID, commands::NAME, self.name);
let author_id: String = format!("{} {} {}", commands::ID, commands::AUTHOR, self.author); let author_id: String = format!("{} {} {}", commands::ID, commands::AUTHOR, self.author);

Loading…
Cancel
Save