Rename TypeBinding to Binding
diff --git a/src/gen/fold.rs b/src/gen/fold.rs
index 11e071f..a9c8951 100644
--- a/src/gen/fold.rs
+++ b/src/gen/fold.rs
@@ -61,6 +61,8 @@
fn fold_bare_fn_arg_name(&mut self, i: BareFnArgName) -> BareFnArgName { fold_bare_fn_arg_name(self, i) }
fn fold_bin_op(&mut self, i: BinOp) -> BinOp { fold_bin_op(self, i) }
+
+fn fold_binding(&mut self, i: Binding) -> Binding { fold_binding(self, i) }
# [ cfg ( feature = "full" ) ]
fn fold_block(&mut self, i: Block) -> Block { fold_block(self, i) }
@@ -332,8 +334,6 @@
fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn { fold_type_bare_fn(self, i) }
-fn fold_type_binding(&mut self, i: TypeBinding) -> TypeBinding { fold_type_binding(self, i) }
-
fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup { fold_type_group(self, i) }
fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait { fold_type_impl_trait(self, i) }
@@ -655,6 +655,14 @@
}
}
}
+
+pub fn fold_binding<V: Folder + ?Sized>(_visitor: &mut V, _i: Binding) -> Binding {
+ Binding {
+ ident: _visitor.fold_ident(_i . ident),
+ eq_token: Token ! [ = ](tokens_helper(_visitor, &(_i . eq_token).0)),
+ ty: _visitor.fold_type(_i . ty),
+ }
+}
# [ cfg ( feature = "full" ) ]
pub fn fold_block<V: Folder + ?Sized>(_visitor: &mut V, _i: Block) -> Block {
Block {
@@ -1460,9 +1468,9 @@
_visitor.fold_type(_binding_0),
)
}
- TypeBinding(_binding_0, ) => {
- TypeBinding (
- _visitor.fold_type_binding(_binding_0),
+ Binding(_binding_0, ) => {
+ Binding (
+ _visitor.fold_binding(_binding_0),
)
}
Const(_binding_0, ) => {
@@ -2526,14 +2534,6 @@
}
}
-pub fn fold_type_binding<V: Folder + ?Sized>(_visitor: &mut V, _i: TypeBinding) -> TypeBinding {
- TypeBinding {
- ident: _visitor.fold_ident(_i . ident),
- eq_token: Token ! [ = ](tokens_helper(_visitor, &(_i . eq_token).0)),
- ty: _visitor.fold_type(_i . ty),
- }
-}
-
pub fn fold_type_group<V: Folder + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
TypeGroup {
group_token: Group(tokens_helper(_visitor, &(_i . group_token).0)),
diff --git a/src/gen/visit.rs b/src/gen/visit.rs
index 3ca692f..af09e68 100644
--- a/src/gen/visit.rs
+++ b/src/gen/visit.rs
@@ -57,6 +57,8 @@
fn visit_bare_fn_arg_name(&mut self, i: &'ast BareFnArgName) { visit_bare_fn_arg_name(self, i) }
fn visit_bin_op(&mut self, i: &'ast BinOp) { visit_bin_op(self, i) }
+
+fn visit_binding(&mut self, i: &'ast Binding) { visit_binding(self, i) }
# [ cfg ( feature = "full" ) ]
fn visit_block(&mut self, i: &'ast Block) { visit_block(self, i) }
@@ -328,8 +330,6 @@
fn visit_type_bare_fn(&mut self, i: &'ast TypeBareFn) { visit_type_bare_fn(self, i) }
-fn visit_type_binding(&mut self, i: &'ast TypeBinding) { visit_type_binding(self, i) }
-
fn visit_type_group(&mut self, i: &'ast TypeGroup) { visit_type_group(self, i) }
fn visit_type_impl_trait(&mut self, i: &'ast TypeImplTrait) { visit_type_impl_trait(self, i) }
@@ -563,6 +563,12 @@
}
}
}
+
+pub fn visit_binding<'ast, V: Visitor<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast Binding) {
+ _visitor.visit_ident(& _i . ident);
+ tokens_helper(_visitor, &(& _i . eq_token).0);
+ _visitor.visit_type(& _i . ty);
+}
# [ cfg ( feature = "full" ) ]
pub fn visit_block<'ast, V: Visitor<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast Block) {
tokens_helper(_visitor, &(& _i . brace_token).0);
@@ -1152,8 +1158,8 @@
Type(ref _binding_0, ) => {
_visitor.visit_type(_binding_0);
}
- TypeBinding(ref _binding_0, ) => {
- _visitor.visit_type_binding(_binding_0);
+ Binding(ref _binding_0, ) => {
+ _visitor.visit_binding(_binding_0);
}
Const(ref _binding_0, ) => {
_visitor.visit_expr(_binding_0);
@@ -1955,12 +1961,6 @@
_visitor.visit_return_type(& _i . output);
}
-pub fn visit_type_binding<'ast, V: Visitor<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast TypeBinding) {
- _visitor.visit_ident(& _i . ident);
- tokens_helper(_visitor, &(& _i . eq_token).0);
- _visitor.visit_type(& _i . ty);
-}
-
pub fn visit_type_group<'ast, V: Visitor<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast TypeGroup) {
tokens_helper(_visitor, &(& _i . group_token).0);
_visitor.visit_type(& * _i . elem);
diff --git a/src/gen/visit_mut.rs b/src/gen/visit_mut.rs
index d804e2c..6cd1cfa 100644
--- a/src/gen/visit_mut.rs
+++ b/src/gen/visit_mut.rs
@@ -57,6 +57,8 @@
fn visit_bare_fn_arg_name_mut(&mut self, i: &mut BareFnArgName) { visit_bare_fn_arg_name_mut(self, i) }
fn visit_bin_op_mut(&mut self, i: &mut BinOp) { visit_bin_op_mut(self, i) }
+
+fn visit_binding_mut(&mut self, i: &mut Binding) { visit_binding_mut(self, i) }
# [ cfg ( feature = "full" ) ]
fn visit_block_mut(&mut self, i: &mut Block) { visit_block_mut(self, i) }
@@ -328,8 +330,6 @@
fn visit_type_bare_fn_mut(&mut self, i: &mut TypeBareFn) { visit_type_bare_fn_mut(self, i) }
-fn visit_type_binding_mut(&mut self, i: &mut TypeBinding) { visit_type_binding_mut(self, i) }
-
fn visit_type_group_mut(&mut self, i: &mut TypeGroup) { visit_type_group_mut(self, i) }
fn visit_type_impl_trait_mut(&mut self, i: &mut TypeImplTrait) { visit_type_impl_trait_mut(self, i) }
@@ -563,6 +563,12 @@
}
}
}
+
+pub fn visit_binding_mut<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Binding) {
+ _visitor.visit_ident_mut(& mut _i . ident);
+ tokens_helper(_visitor, &mut (& mut _i . eq_token).0);
+ _visitor.visit_type_mut(& mut _i . ty);
+}
# [ cfg ( feature = "full" ) ]
pub fn visit_block_mut<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Block) {
tokens_helper(_visitor, &mut (& mut _i . brace_token).0);
@@ -1152,8 +1158,8 @@
Type(ref mut _binding_0, ) => {
_visitor.visit_type_mut(_binding_0);
}
- TypeBinding(ref mut _binding_0, ) => {
- _visitor.visit_type_binding_mut(_binding_0);
+ Binding(ref mut _binding_0, ) => {
+ _visitor.visit_binding_mut(_binding_0);
}
Const(ref mut _binding_0, ) => {
_visitor.visit_expr_mut(_binding_0);
@@ -1955,12 +1961,6 @@
_visitor.visit_return_type_mut(& mut _i . output);
}
-pub fn visit_type_binding_mut<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TypeBinding) {
- _visitor.visit_ident_mut(& mut _i . ident);
- tokens_helper(_visitor, &mut (& mut _i . eq_token).0);
- _visitor.visit_type_mut(& mut _i . ty);
-}
-
pub fn visit_type_group_mut<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TypeGroup) {
tokens_helper(_visitor, &mut (& mut _i . group_token).0);
_visitor.visit_type_mut(& mut * _i . elem);
diff --git a/src/lib.rs b/src/lib.rs
index 44df480..46f0e46 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -88,9 +88,9 @@
mod ty;
pub use ty::{Abi, AngleBracketedGenericArguments, BareFnArg, BareFnArgName,
- GenericArgument, ParenthesizedGenericArguments, Path,
+ Binding, GenericArgument, ParenthesizedGenericArguments, Path,
PathArguments, PathSegment, PolyTraitRef, QSelf, ReturnType, Type, TypeArray,
- TypeBareFn, TypeBinding, TypeGroup, TypeImplTrait, TypeInfer, TypeMacro, TypeNever, TypeParen,
+ TypeBareFn, TypeGroup, TypeImplTrait, TypeInfer, TypeMacro, TypeNever, TypeParen,
TypePath, TypePtr, TypeReference, TypeSlice, TypeTraitObject, TypeTuple, TypeVerbatim};
#[cfg(feature = "printing")]
pub use ty::PathTokens;
diff --git a/src/ty.rs b/src/ty.rs
index 2d4deee..4f4047e 100644
--- a/src/ty.rs
+++ b/src/ty.rs
@@ -226,7 +226,7 @@
/// Bindings (equality constraints) on associated types, if present.
///
/// E.g., `Foo<A=Bar>`.
- TypeBinding(TypeBinding),
+ Binding(Binding),
/// Const expression. Must be inside of a block.
///
/// NOTE: Identity expressions are represented as Type arguments, as
@@ -247,7 +247,7 @@
ast_struct! {
/// Bind a type to an associated type: `A=Foo`.
- pub struct TypeBinding {
+ pub struct Binding {
pub ident: Ident,
pub eq_token: Token![=],
pub ty: Type,
@@ -668,7 +668,7 @@
|
syn!(Lifetime) => { GenericArgument::Lifetime }
|
- syn!(TypeBinding) => { GenericArgument::TypeBinding }
+ syn!(Binding) => { GenericArgument::Binding }
));
}
@@ -679,7 +679,7 @@
|
syn!(Lifetime) => { GenericArgument::Lifetime }
|
- syn!(TypeBinding) => { GenericArgument::TypeBinding }
+ syn!(Binding) => { GenericArgument::Binding }
|
syn!(ExprLit) => { |l| GenericArgument::Const(Expr::Lit(l).into()) }
|
@@ -743,12 +743,12 @@
keyword!(crate) => { Into::into }
));
- impl Synom for TypeBinding {
+ impl Synom for Binding {
named!(parse -> Self, do_parse!(
id: syn!(Ident) >>
eq: punct!(=) >>
ty: syn!(Type) >>
- (TypeBinding {
+ (Binding {
ident: id,
eq_token: eq,
ty: ty,
@@ -1021,7 +1021,7 @@
match *self {
GenericArgument::Lifetime(ref lt) => lt.to_tokens(tokens),
GenericArgument::Type(ref ty) => ty.to_tokens(tokens),
- GenericArgument::TypeBinding(ref tb) => tb.to_tokens(tokens),
+ GenericArgument::Binding(ref tb) => tb.to_tokens(tokens),
GenericArgument::Const(ref e) => match *e {
Expr::Lit(_) => e.to_tokens(tokens),
@@ -1050,7 +1050,7 @@
}
}
- impl ToTokens for TypeBinding {
+ impl ToTokens for Binding {
fn to_tokens(&self, tokens: &mut Tokens) {
self.ident.to_tokens(tokens);
self.eq_token.to_tokens(tokens);