@@ -11,9 +11,9 @@ use syn::token::{Brace, Colon, Comma, Eq, Paren, Semi};
1111use syn:: { parse_quote, punctuated:: Punctuated , spanned:: Spanned } ;
1212use syn:: { Attribute , GenericParam , Generics , Ident , ItemImpl , Member , Token , Type , TypePath } ;
1313
14- /// A field of a [`Singleton `]
14+ /// A field of a [`Anon `]
1515#[ derive( Debug ) ]
16- pub struct SingletonField {
16+ pub struct AnonField {
1717 /// Field attributes
1818 pub attrs : Vec < Attribute > ,
1919 /// Field visibility
@@ -32,13 +32,13 @@ pub struct SingletonField {
3232 pub assignment : Option < ( Eq , syn:: Expr ) > ,
3333}
3434
35- /// A struct with a single instantiation
35+ /// Contents of `impl_anon!`
3636///
37- /// The singleton macro may be used to conveniently declare a struct's type,
37+ /// The impl_anon macro may be used to conveniently declare a struct's type,
3838/// implementations and construct an instance.
3939/// This struct represents the macro's input.
4040#[ derive( Debug ) ]
41- pub struct Singleton {
41+ pub struct Anon {
4242 /// Struct attributes
4343 pub attrs : Vec < Attribute > ,
4444 /// `struct` token
@@ -50,14 +50,14 @@ pub struct Singleton {
5050 /// Struct style: unit/tuple/regular
5151 pub style : StructStyle ,
5252 /// Struct fields
53- pub fields : Punctuated < SingletonField , Comma > ,
53+ pub fields : Punctuated < AnonField , Comma > ,
5454 /// (Explicit) struct implementations
5555 pub impls : Vec < ItemImpl > ,
5656}
5757
58- impl Singleton {
59- /// Convert to a [`SingletonScope `]
60- pub fn into_scope ( mut self ) -> SingletonScope {
58+ impl Anon {
59+ /// Convert to a [`AnonScope `]
60+ pub fn into_scope ( mut self ) -> AnonScope {
6161 let mut idfmt = IdentFormatter :: new ( ) ;
6262
6363 let mut fields = Punctuated :: < Field , Comma > :: new ( ) ;
@@ -221,7 +221,7 @@ impl Singleton {
221221 let scope = Scope {
222222 attrs : self . attrs ,
223223 vis : syn:: Visibility :: Inherited ,
224- ident : parse_quote ! { _Singleton } ,
224+ ident : parse_quote ! { _Anon } ,
225225 generics : self . generics ,
226226 item : ScopeItem :: Struct {
227227 token : self . token ,
@@ -232,7 +232,7 @@ impl Singleton {
232232 generated : vec ! [ ] ,
233233 } ;
234234
235- SingletonScope ( scope, field_val_toks)
235+ AnonScope ( scope, field_val_toks)
236236 }
237237}
238238
@@ -243,21 +243,21 @@ impl Singleton {
243243///
244244/// Tokens may be generated by [`Self::expand`].
245245#[ derive( Debug ) ]
246- pub struct SingletonScope ( Scope , TokenStream ) ;
246+ pub struct AnonScope ( Scope , TokenStream ) ;
247247
248- impl std:: ops:: Deref for SingletonScope {
248+ impl std:: ops:: Deref for AnonScope {
249249 type Target = Scope ;
250250 fn deref ( & self ) -> & Scope {
251251 & self . 0
252252 }
253253}
254- impl std:: ops:: DerefMut for SingletonScope {
254+ impl std:: ops:: DerefMut for AnonScope {
255255 fn deref_mut ( & mut self ) -> & mut Scope {
256256 & mut self . 0
257257 }
258258}
259259
260- impl SingletonScope {
260+ impl AnonScope {
261261 /// Generate the [`TokenStream`]
262262 ///
263263 /// This is a convenience function. It is valid to, instead, (1) call
@@ -269,7 +269,7 @@ impl SingletonScope {
269269 }
270270}
271271
272- impl ToTokens for SingletonScope {
272+ impl ToTokens for AnonScope {
273273 fn to_tokens ( & self , tokens : & mut TokenStream ) {
274274 let scope = & self . 0 ;
275275 let field_val_toks = & self . 1 ;
@@ -278,7 +278,7 @@ impl ToTokens for SingletonScope {
278278 {
279279 #scope
280280
281- _Singleton {
281+ _Anon {
282282 #field_val_toks
283283 }
284284 }
@@ -389,7 +389,7 @@ mod parsing {
389389 } )
390390 }
391391
392- impl SingletonField {
392+ impl AnonField {
393393 fn check_is_fixed ( ty : & Type , input_span : Span ) -> Result < ( ) > {
394394 let is_fixed = match ty {
395395 Type :: ImplTrait ( _) | Type :: Infer ( _) => false ,
@@ -448,7 +448,7 @@ mod parsing {
448448 Self :: check_is_fixed ( & ty, input. span ( ) ) ?;
449449 }
450450
451- Ok ( SingletonField {
451+ Ok ( AnonField {
452452 attrs,
453453 vis,
454454 ident,
@@ -471,7 +471,7 @@ mod parsing {
471471 Self :: check_is_fixed ( & ty, input. span ( ) ) ?;
472472 }
473473
474- Ok ( SingletonField {
474+ Ok ( AnonField {
475475 attrs,
476476 vis,
477477 ident : None ,
@@ -482,7 +482,7 @@ mod parsing {
482482 }
483483 }
484484
485- impl Parse for Singleton {
485+ impl Parse for Anon {
486486 fn parse ( input : ParseStream ) -> Result < Self > {
487487 let attrs = input. call ( Attribute :: parse_outer) ?;
488488 let token = input. parse :: < Token ! [ struct ] > ( ) ?;
@@ -500,7 +500,7 @@ mod parsing {
500500 if generics. where_clause . is_none ( ) && lookahead. peek ( Paren ) {
501501 let content;
502502 let paren_token = parenthesized ! ( content in input) ;
503- fields = content. parse_terminated ( SingletonField :: parse_unnamed, Token ! [ , ] ) ?;
503+ fields = content. parse_terminated ( AnonField :: parse_unnamed, Token ! [ , ] ) ?;
504504
505505 lookahead = input. lookahead1 ( ) ;
506506 if lookahead. peek ( Token ! [ where ] ) {
@@ -517,7 +517,7 @@ mod parsing {
517517 let content;
518518 let brace_token = braced ! ( content in input) ;
519519 style = StructStyle :: Regular ( brace_token) ;
520- fields = content. parse_terminated ( SingletonField :: parse_named, Token ! [ , ] ) ?;
520+ fields = content. parse_terminated ( AnonField :: parse_named, Token ! [ , ] ) ?;
521521 } else if lookahead. peek ( Semi ) {
522522 style = StructStyle :: Unit ( input. parse ( ) ?) ;
523523 fields = Punctuated :: new ( ) ;
@@ -530,7 +530,7 @@ mod parsing {
530530 impls. push ( parse_impl ( None , input) ?) ;
531531 }
532532
533- Ok ( Singleton {
533+ Ok ( Anon {
534534 attrs,
535535 token,
536536 generics,
0 commit comments