File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 180
180
- [Using a Library](crates/using_lib.md)
181
181
-->
182
182
- [ クレート] ( crates.md )
183
- - [ Creating a Library ] ( crates/lib.md )
184
- - [ Using a Library ] ( crates/using_lib.md )
183
+ - [ ライブラリ ] ( crates/lib.md )
184
+ - [ ライブラリの利用 ] ( crates/using_lib.md )
185
185
186
186
- [ Cargo] ( cargo.md )
187
187
- [ Dependencies] ( cargo/deps.md )
Original file line number Diff line number Diff line change
1
+ <!--
1
2
# Using a Library
3
+ -->
4
+ # ライブラリの利用
2
5
6
+ <!--
3
7
To link a crate to this new library you may use `rustc`'s `--extern` flag. All
4
8
of its items will then be imported under a module named the same as the library.
5
9
This module generally behaves the same way as any other module.
10
+ -->
11
+ クレートをこの新しいライブラリにリンクするには、` rustc ` の` --extern ` フラグを利用します。
12
+ クレートの要素を全てライブラリと同じ名前のモジュールにインポートします。
13
+ 一般に、このモジュールは他のモジュールと同じように振る舞います。
6
14
7
15
``` rust,ignore
8
16
// extern crate rary; // May be required for Rust 2015 edition or earlier
17
+ // Rust 2015以前で必要
9
18
10
19
fn main() {
11
20
rary::public_function();
12
21
13
22
// Error! `private_function` is private
23
+ // エラー!`private_function`はプライベート
14
24
//rary::private_function();
15
25
16
26
rary::indirect_access();
@@ -20,6 +30,8 @@ fn main() {
20
30
``` txt
21
31
# Where library.rlib is the path to the compiled library, assumed that it's
22
32
# in the same directory here:
33
+ # library.rlibがコンパイルされたライブラリのパスで、
34
+ # 同じディレクトリにあるものとする:
23
35
$ rustc executable.rs --extern rary=library.rlib && ./executable
24
36
called rary's `public_function()`
25
37
called rary's `indirect_access()`, that
You can’t perform that action at this time.
0 commit comments