yuk1ty / learning-systems-programming-in-rust

「Rustでもわかるシステムプログラミング」
433 stars 23 forks source link

added 9.2.4 ファイルの削除/移動/リネーム 追加 #75

Closed hide5stm closed 3 years ago

hide5stm commented 3 years ago

対象の Issue

9.2 節をリプレースする https://github.com/yuk1ty/learning-systems-programming-in-rust/issues/59

動作確認結果

golang版 9.2.4

$ ./s2-3
$ find .  |xargs ls -lnd
drwxr-xr-x  6 502  20      192  5  9 00:38 .
-rw-r--r--  1 502  20     2066  5  7 23:48 ./main.go
drwxr-xr-x  3 502  20       96  5  9 00:38 ./newdir
-rw-r--r--  1 502  20      448  5  9 00:38 ./newdir/file.txt
-rw-r--r--  1 502  20      448  5  9 00:38 ./renamed.txt
-rwxr-xr-x  1 502  20  1567264  5  8 16:59 ./s2-3
$ cat renamed.txt

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.

Rust版 9.2.4

$ find .  |xargs ls -lnd
drwxr-xr-x  7 502  20   224  5  9 20:42 .
-rw-r--r--  1 502  20   309  5  9 19:56 ./Cargo.toml
drwxr-xr-x  3 502  20    96  5  9 20:42 ./newdir
-rw-r--r--  1 502  20   447  5  9 20:42 ./newdir/file.txt
-rw-r--r--  1 502  20   447  5  9 20:42 ./renamed.txt
drwxr-xr-x  4 502  20   128  5  9 20:42 ./src
-rw-r--r--  1 502  20    45  5  8 23:30 ./src/main.rs
-rw-r--r--  1 502  20  1834  5  9 20:42 ./src/main_9_2_4.rs
-rw-r--r--  1 502  20   100  5  9 20:42 ./truncated.txt
$ cat renamed.txt

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
yuk1ty commented 3 years ago

5/14 23:59 くらいまでオープンしておきます。