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/rust-2021/prelude.md
+7-5Lines changed: 7 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,7 @@ Some users invoke methods on a `dyn Trait` value where the method name overlaps
85
85
86
86
```rust
87
87
modsubmodule {
88
-
traitMyTrait {
88
+
pubtraitMyTrait {
89
89
// This has the same name as `TryInto::try_into`
90
90
fntry_into(&self) ->Result<u32, ()>;
91
91
}
@@ -114,23 +114,25 @@ ensures that we're calling `try_into` on the `dyn MyTrait` which can only refer
114
114
Many types define their own inherent methods with the same name as a trait method. For instance, below the struct `MyStruct` implements `from_iter` which shares the same name with the method from the trait `FromIterator` found in the standard library:
115
115
116
116
```rust
117
+
usestd::iter::IntoIterator;
118
+
117
119
structMyStruct {
118
120
data:Vec<u32>
119
121
}
120
122
121
123
implMyStruct {
122
124
// This has the same name as `std::iter::FromIterator::from_iter`
0 commit comments