@@ -14,9 +14,14 @@ information from the file/directory the path points to.
14
14
-->
15
15
` Path ` は` OsStr ` から作ることができます。そうすればそのパスが指すファイル・ディレクトリの情報を取得するためのメソッドがいくつか使えるようになります。
16
16
17
+ <!--
17
18
A `Path` is immutable. The owned version of `Path` is `PathBuf`. The relation
18
19
between `Path` and `PathBuf` is similar to that of `str` and `String`:
19
20
a `PathBuf` can be mutated in-place, and can be dereferenced to a `Path`.
21
+ -->
22
+ ` Path ` はイミュータブルです。` Path ` の所有権ありのバージョンが` PathBuf ` です。
23
+ ` Path ` と` PathBuf ` の関係は、` str ` と` String ` の関係に似ています。
24
+ ` PathBuf ` はそのまま変更でき、` Path ` にデリファレンスすることができます。
20
25
21
26
<!--
22
27
Note that a `Path` is *not* internally represented as an UTF-8 string, but
@@ -47,10 +52,12 @@ fn main() {
47
52
let mut new_path = path.join("a").join("b");
48
53
49
54
// `push` extends the `PathBuf` with a `&Path`
55
+ // `push`は`PathBuf`を`&Path`で拡張する。
50
56
new_path.push("c");
51
57
new_path.push("myfile.tar.gz");
52
58
53
59
// `set_file_name` updates the file name of the `PathBuf`
60
+ // `set_file_name`は`PathBuf`のファイル名を更新する。
54
61
new_path.set_file_name("package.tgz");
55
62
56
63
// Convert the `PathBuf` into a string slice
@@ -74,7 +81,10 @@ the `Metadata` struct.
74
81
-->
75
82
### 参照
76
83
84
+ <!--
77
85
[OsStr][1] and [Metadata][2].
86
+ -->
87
+ [ OsStr] [ 1 ] ならびに [ Metadata] [ 2 ] 。
78
88
79
89
[ 1 ] : https://doc.rust-lang.org/std/ffi/struct.OsStr.html
80
90
[ 2 ] : https://doc.rust-lang.org/std/fs/struct.Metadata.html
0 commit comments