File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 195
195
| struct | 構造体
196
196
| structure | 構造体
197
197
| sum type | 直和型
198
+ | subtrait | サブトレイト
199
+ | supertrait | スーパートレイト
198
200
| symbol | シンボル
199
201
| syntactic sugar | 糖衣構文
200
202
| syntax tree | 構文木
Original file line number Diff line number Diff line change 294
294
- [ イテレータ] ( trait/iter.md )
295
295
- [ ` impl Trait ` ] ( trait/impl_trait.md )
296
296
- [ クローン] ( trait/clone.md )
297
- - [ Supertraits ] ( trait/supertraits.md )
297
+ - [ スーパートレイト ] ( trait/supertraits.md )
298
298
- [ Disambiguating overlapping traits] ( trait/disambiguating.md )
299
299
300
300
<!--
Original file line number Diff line number Diff line change
1
+ <!--
1
2
# Supertraits
3
+ -->
4
+ # スーパートレイト
2
5
6
+ <!--
3
7
Rust doesn't have "inheritance", but you can define a trait as being a superset
4
8
of another trait. For example:
9
+ -->
10
+ Rustには"継承"はありませんが、あるトレイトを別のトレイトの上位集合として定義できます。
11
+ 例えば:
5
12
6
13
``` rust,editable
7
14
trait Person {
@@ -10,6 +17,8 @@ trait Person {
10
17
11
18
// Person is a supertrait of Student.
12
19
// Implementing Student requires you to also impl Person.
20
+ // PersonはStudentのスーパートレイトです。
21
+ // Studentを実装するにはPersonも実装する必要があります。
13
22
trait Student: Person {
14
23
fn university(&self) -> String;
15
24
}
@@ -20,6 +29,8 @@ trait Programmer {
20
29
21
30
// CompSciStudent (computer science student) is a subtrait of both Programmer
22
31
// and Student. Implementing CompSciStudent requires you to impl both supertraits.
32
+ // CompSciStudent(コンピュータサイエンスの学生)はProgrammerとStudent両方のサブトレイトです。
33
+ // CompSciStudentを実装するには、両方のスーパートレイトを実装する必要があります。
23
34
trait CompSciStudent: Programmer + Student {
24
35
fn git_username(&self) -> String;
25
36
}
You can’t perform that action at this time.
0 commit comments