Explorar el Código

Init files, made some base constructs

Lorenz Bung hace 8 años
padre
commit
f9ff47ae47
Se han modificado 2 ficheros con 34 adiciones y 0 borrados
  1. 0
    0
      hw6/task2/src/command.rs
  2. 34
    0
      hw6/task2/src/shell.rs

+ 0
- 0
hw6/task2/src/command.rs Ver fichero


+ 34
- 0
hw6/task2/src/shell.rs Ver fichero

@@ -0,0 +1,34 @@
1
+struct Shell<R, W> {
2
+    pub reader: R,
3
+    pub writer: W,
4
+    pub should_exit: bool,
5
+    pub name: String,
6
+}
7
+
8
+impl Shell<R, W> {
9
+    pub fn new(input: R, output: W, name: String) -> Self {
10
+        Shell {
11
+            reader = input,
12
+            writer = output,
13
+            name = name,
14
+        }
15
+    }
16
+}
17
+
18
+impl BufRead for Shell<R, W> {
19
+}
20
+
21
+impl Write for Shell<R, W> {
22
+    fn write(&mut self, buf: &[u8]) -> Result<usize> {}
23
+    fn flush(&mut self) -> Result<()> {}
24
+    fn write_all(&mut self, buf: &[u8]) -> Result<()> {}
25
+    fn write_format(&mut self, fmt: Arguments) -> Result<()> {}
26
+    fn by_ref(&mut self) -> &mut Self where Self: Sized, {}
27
+}
28
+
29
+
30
+let mut s = Shell::new();
31
+    match s.start() {
32
+        Ok(_) => process::exit(0),
33
+        Err(_) => process::exit(1),
34
+    }

Loading…
Cancelar
Guardar