1
1
# Paths
2
2
3
3
A * path* is a sequence of one or more path components _ logically_ separated by
4
- a namespace qualifier (` :: ` ). If a path consists of only one component, it
5
- refers to either an [ item] or a [ variable] in a local control
6
- scope. If a path has multiple components, it always refers to an item.
4
+ a namespace <span class =" parenthetical " >qualifier (` :: ` )</span >. If a path
5
+ consists of only one component, it refers to either an [ item] or a [ variable] in
6
+ a local control scope. If a path has multiple components, it always refers to an
7
+ item.
7
8
8
9
Two examples of simple paths consisting of only identifier components:
9
10
@@ -15,8 +16,9 @@ x::y::z;
15
16
Path components are usually [ identifiers] , but they may also include
16
17
angle-bracket-enclosed lists of type arguments. In [ expression] context, the
17
18
type argument list is given after a ` :: ` namespace qualifier in order to
18
- disambiguate it from a relational expression involving the less-than symbol
19
- (` < ` ). In type expression context, the final namespace qualifier is omitted.
19
+ disambiguate it from a relational expression involving the less-than
20
+ <span class =" parenthetical " >symbol (` < ` )</span >. In type expression context, the
21
+ final namespace qualifier is omitted.
20
22
21
23
Two examples of paths with type arguments:
22
24
@@ -110,9 +112,10 @@ bound on a type parameter, do not have canonical paths.
110
112
111
113
The path prefix for modules is the canonical path to that module. For bare
112
114
implementations, it is the canonical path of the item being implemented
113
- surrounded by angle (` <> ` ) brackets. For trait implementations, it is the
114
- canonical path of the item being implemented followed by ` as ` followed by the
115
- canonical path to the trait all surrounded in angle (` <> ` ) brackets.
115
+ surrounded by <span class =" parenthetical " >angle (` <> ` )</span > brackets. For
116
+ trait implementations, it is the canonical path of the item being implemented
117
+ followed by ` as ` followed by the canonical path to the trait all surrounded in
118
+ <span class =" parenthetical " >angle (` <> ` )</span > brackets.
116
119
117
120
The canonical path is only meaningful within a given crate. There is no global
118
121
namespace across crates; an item's canonical path merely identifies it within
0 commit comments