We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
self
1 parent cd8193e commit e8ddd3cCopy full SHA for e8ddd3c
src/paths.md
@@ -202,11 +202,20 @@ mod b {
202
`self` resolves the path relative to the current module. `self` can only be used as the
203
first segment, without a preceding `::`.
204
205
+In a method body, a path which consists of a single `self` segment resolves to the method's self parameter.
206
+
207
208
```rust
209
fn foo() {}
210
fn bar() {
211
self::foo();
212
}
213
+struct S(bool);
214
+impl S {
215
+ fn baz(self) {
216
+ self.0;
217
+ }
218
+}
219
# fn main() {}
220
```
221
0 commit comments