瀏覽代碼

Command message now is stopped at newline

Lorenz 7 年之前
父節點
當前提交
8a56642f36
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2
    2
      hw9/task1/src/lib.rs

+ 2
- 2
hw9/task1/src/lib.rs 查看文件

@@ -6,11 +6,11 @@ pub fn parse(message: &str) -> Result<Command, ParseError> {
6 6
             let mut str = x.split_whitespace();
7 7
             match str.next() {
8 8
                 Some("STAGE") => {
9
-                    let msg = m[6..].trim_left();
9
+                    let msg = x[6..].trim_left();
10 10
                     Ok(Command::Stage(msg.to_string()))
11 11
                 }
12 12
                 Some("CONTROL") => {
13
-                    let cmd = m[8..].trim_left();
13
+                    let cmd = x[8..].trim_left();
14 14
                     Ok(Command::Control(cmd.to_string()))
15 15
                 }
16 16
                 Some("RETRIEVE") => Ok(Command::Retrieve),

Loading…
取消
儲存