You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/items/implementations.md
+15-10Lines changed: 15 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Implementations
2
2
3
-
An _implementation_ is an item that associates items with a*implementing type*.
3
+
An _implementation_ is an item that associates items with an*implementing type*.
4
4
5
5
There are two types of implementations: Bare implementations and [trait]
6
6
implementations.
@@ -11,16 +11,22 @@ Implementations are defined with the keyword `impl`.
11
11
12
12
A bare implementation is defined as the keyword `impl` optionally followed by
13
13
generic type declarations followed by a [nominal] type optionally followed by
14
-
where clauses followed by a container of braces of a set of zero or more
15
-
associable items.
14
+
where clauses followed by a set of zero or more associable items contained
15
+
within braces.
16
+
17
+
sequence of 'impl' keyword, generic type declarations, nominal type, where clause and the associable items. Generic type declarations and where clause can be omitted, if not needed. The associable items are contained within braces.
18
+
19
+
A bare implementation is defined as the sequence of the `impl` keyword, generic
20
+
type declarations, a path to a nomial tyupe, a where clause, and a bracketed
21
+
set of associable items.
16
22
17
23
The nominal type is called the *implementing type* and the associable items are
18
24
the *associated items* to the implementing type.
19
25
20
26
Bare implementations associates the associated items to the implementing type.
21
27
22
-
The associated item has a canonical path of the canonical path of the
23
-
implementing type followed by the associate item's path component.
28
+
The associated item has a path of a path to the implementing type followed by
29
+
the associate item's path component.
24
30
25
31
A type can have multiple bare implementations.
26
32
@@ -54,10 +60,9 @@ A trait implementation must define all non-default associated items declared
54
60
by the implemented trait, may redefine default associated items defined by the
55
61
implemented trait trait, and cannot define any other items.
56
62
57
-
The canonical path to the associated items is `<` followed by the canonical path
58
-
of the implementing type followed by `as` followed by the canonical path to the
59
-
trait followed by `>` as a path component followed by the associated item's path
60
-
component.
63
+
The path to the associated items is `<` followed by a path to the implementing
64
+
type followed by `as` followed by a path to the trait followed by `>` as a path
65
+
component followed by the associated item's path component.
61
66
62
67
```rust
63
68
# #[derive(Copy, Clone)]
@@ -110,7 +115,7 @@ the following conditions:
110
115
meet the following grammar, where `C` is a nominal type defined
0 commit comments