File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,14 @@ the same way associated types are bound with regular traits:
133
133
fn foo <I >(int_iter : I ) where I : IntoIntIterator <IntoIter = std :: slice :: Iter <i32 >> {}
134
134
```
135
135
136
+ A trait alias can be parameterized over types and lifetimes, just like traits themselves:
137
+
138
+ ``` rust
139
+ trait LifetimeParametric <'a > = Iterator <Item = Cow <'a , [i32 ]>>;`
140
+
141
+ trait TypeParametric <T > = Iterator <Item = Cow <'static , [T ]>>;
142
+ ```
143
+
136
144
---
137
145
138
146
Specifically, the grammar being added is, in informal notation:
@@ -144,6 +152,8 @@ ATTRIBUTE* VISIBILITY? trait IDENTIFIER(<GENERIC_PARAMS>)? = GENERIC_BOUNDS (whe
144
152
` GENERIC_BOUNDS ` is a list of zero or more traits and lifetimes separated by ` + ` , the same as the
145
153
current syntax for bounds on a type parameter, and ` PREDICATES ` is a comma-separated list of zero or
146
154
more predicates, just like any other ` where ` clause.
155
+ ` GENERIC_PARAMS ` is a comma-separated list of zero or more lifetime and type parameters,
156
+ with optional bounds, just like other generic definitions.
147
157
148
158
## Use semantics
149
159
You can’t perform that action at this time.
0 commit comments