浏览代码

Init files, made some base constructs

Lorenz Bung 8 年前
父节点
当前提交
f9ff47ae47
共有 2 个文件被更改,包括 34 次插入0 次删除
  1. 0
    0
      hw6/task2/src/command.rs
  2. 34
    0
      hw6/task2/src/shell.rs

+ 0
- 0
hw6/task2/src/command.rs 查看文件


+ 34
- 0
hw6/task2/src/shell.rs 查看文件

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
+    }

正在加载...
取消
保存