Skip to content

Commit 16f9298

Browse files
committed
more flexible specialize! type target
1 parent 1a994b3 commit 16f9298

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,15 @@ macro_rules! specialize {
190190
(@parse_impl $trait_id:ident $trait_fn:tt
191191
match impl[
192192
$($trait_impl_bounds:tt)*
193-
] for $trait_impl_id:ident where [
193+
] for $trait_impl_id:ty where [
194194
$($trait_impl_where:tt)+
195195
] {
196196
$($unparsed:tt)*
197197
}
198198
) => {
199199
specialize! {
200200
@parse
201-
($trait_id $trait_impl_id ($($trait_impl_bounds)*) (, $($trait_impl_where)+))
201+
($trait_id ($trait_impl_id) ($($trait_impl_bounds)*) (, $($trait_impl_where)+))
202202
$trait_fn
203203
()
204204
($($unparsed)*)
@@ -207,13 +207,13 @@ macro_rules! specialize {
207207
(@parse_impl $trait_id:ident $trait_fn:tt
208208
match impl[
209209
$($trait_impl_bounds:tt)*
210-
] for $trait_impl_id:ident {
210+
] for $trait_impl_id:ty {
211211
$($unparsed:tt)*
212212
}
213213
) => {
214214
specialize! {
215215
@parse
216-
($trait_id $trait_impl_id ($($trait_impl_bounds)*) ())
216+
($trait_id ($trait_impl_id) ($($trait_impl_bounds)*) ())
217217
$trait_fn
218218
()
219219
($($unparsed)*)
@@ -297,13 +297,13 @@ macro_rules! specialize {
297297
};
298298
// Clause to trait impl
299299
(@itemize
300-
($trait_id:ident $trait_impl_id:ident ($($trait_impl_bounds:tt)*) ($($trait_impl_where:tt)*))
300+
($trait_id:ident ($trait_impl_id:ty) ($($trait_impl_bounds:tt)*) ($($trait_impl_where:tt)*))
301301
($trait_fn_id:ident ($trait_fn_ty:ty) ($($trait_fn_bounds:tt)*) ($($trait_fn_where:tt)*) ($($trait_fn_args:tt)*))
302302
($($items:tt)*)
303303
((($($clause_bounds:tt)*) ($($clause_where:tt)*) $clause_expr:expr) $($clauses:tt)*)
304304
) => {
305305
specialize! { @itemize
306-
($trait_id $trait_impl_id ($($trait_impl_bounds)*) ($($trait_impl_where)*))
306+
($trait_id ($trait_impl_id) ($($trait_impl_bounds)*) ($($trait_impl_where)*))
307307
($trait_fn_id ($trait_fn_ty) ($($trait_fn_bounds)*) ($($trait_fn_where)*) ($($trait_fn_args)*))
308308
($($items)*
309309
impl<$($trait_impl_bounds)*, $($clause_bounds)*> $trait_id for $trait_impl_id where $($clause_where)* $($trait_impl_where)* {
@@ -333,7 +333,7 @@ macro_rules! specialize {
333333
specialize! { @items $($items)* }
334334
};
335335
(@trait
336-
($trait_id:ident $trait_impl_id:ident ($($trait_impl_bounds:tt)*) ($($trait_impl_where:tt)*))
336+
($trait_id:ident ($trait_impl_id:ty) ($($trait_impl_bounds:tt)*) ($($trait_impl_where:tt)*))
337337
($trait_fn_id:ident ($trait_fn_ty:ty) ($($trait_fn_bounds:tt)*) ($($trait_fn_where:tt)*) ($($trait_fn_args:tt)*))
338338
) => {
339339
specialize! { @items
@@ -346,14 +346,14 @@ macro_rules! specialize {
346346
}
347347
};
348348
/*(@
349-
($trait_id:ident $trait_impl_id:ident ($($trait_impl_bounds:tt)*) ($($trait_impl_where:tt)*))
349+
($trait_id:ident ($trait_impl_id:ty) ($($trait_impl_bounds:tt)*) ($($trait_impl_where:tt)*))
350350
($trait_fn_id:ident ($trait_fn_ty:ty) ($($trait_fn_bounds:tt)*) ($($trait_fn_where:tt)*) ($($trait_fn_args:tt)*))
351351
($($items:tt)*)
352352
($($clauses:tt)*)
353353
($($unparsed:tt)*)
354354
) => {
355355
specialize! { @
356-
($trait_id $trait_impl_id ($($trait_impl_bounds)*) ($($trait_impl_where)*))
356+
($trait_id ($trait_impl_id) ($($trait_impl_bounds)*) ($($trait_impl_where)*))
357357
($trait_fn_id ($trait_fn_ty) ($($trait_fn_bounds)*) ($($trait_fn_where)*) ($($trait_fn_args)*))
358358
($($items:tt)*)
359359
($($clauses:tt)*)

0 commit comments

Comments
 (0)