Ver código fonte

Command message now is stopped at newline

Lorenz 8 anos atrás
pai
commit
8a56642f36
1 arquivos alterados com 2 adições e 2 exclusões
  1. 2
    2
      hw9/task1/src/lib.rs

+ 2
- 2
hw9/task1/src/lib.rs Ver arquivo

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

Carregando…
Cancelar
Salvar