@@ -29,10 +29,9 @@ pub struct DeriveArgs {
2929pub struct FieldArgs {
3030 /// the name of field
3131 pub ident : Option < syn:: Ident > ,
32- pub vis : syn:: Visibility ,
32+ // pub vis: syn::Visibility,
3333 /// the type of field
3434 pub ty : Type ,
35- pub attrs : Vec < syn:: Attribute > ,
3635 // custom attributes
3736 /// The index of the field in the struct, starts from 0 default.
3837 pub index : Option < usize > ,
@@ -51,21 +50,6 @@ pub struct FieldArgs {
5150 pub iter : Option < Type > ,
5251}
5352
54- #[ derive( FromVariant , Debug ) ]
55- #[ darling( attributes( columnar) ) ]
56- pub struct VariantArgs {
57- // pub ident: syn::Ident,
58- // pub vis: syn::Visibility,
59- // pub ty: syn::Type,
60- pub attrs : Vec < syn:: Attribute > ,
61- /// the type of the column format, vec or map.
62- #[ darling( rename = "class" ) ]
63- pub type_ : Option < String > ,
64- /// If skip, this field will be ignored.
65- #[ darling( default ) ]
66- pub skip : bool ,
67- }
68-
6953#[ derive( Debug , Clone , Copy ) ]
7054pub enum Strategy {
7155 Rle ,
@@ -98,11 +82,10 @@ pub enum AsType {
9882}
9983
10084pub trait Args {
101- fn ident ( & self ) -> Option < syn:: Ident > ;
85+ // fn ident(&self) -> Option<syn::Ident>;
10286 fn ty ( & self ) -> Option < syn:: Type > ;
103- fn attrs ( & self ) -> & [ syn:: Attribute ] ;
104- fn index ( & self ) -> Option < usize > ;
105- fn optional ( & self ) -> bool ;
87+ // fn index(&self) -> Option<usize>;
88+ // fn optional(&self) -> bool;
10689 fn strategy ( & self ) -> Strategy ;
10790 fn can_copy ( & self ) -> bool {
10891 match self . strategy ( ) {
@@ -147,21 +130,10 @@ pub trait Args {
147130}
148131
149132impl Args for FieldArgs {
150- fn ident ( & self ) -> Option < syn:: Ident > {
151- self . ident . clone ( )
152- }
153133 fn ty ( & self ) -> Option < syn:: Type > {
154134 Some ( self . ty . clone ( ) )
155135 }
156- fn attrs ( & self ) -> & [ syn:: Attribute ] {
157- & self . attrs
158- }
159- fn index ( & self ) -> Option < usize > {
160- self . index
161- }
162- fn optional ( & self ) -> bool {
163- self . optional
164- }
136+
165137 fn strategy ( & self ) -> Strategy {
166138 Strategy :: from_str ( self . strategy . clone ( ) )
167139 }
@@ -265,50 +237,6 @@ impl Args for FieldArgs {
265237 }
266238}
267239
268- impl Args for VariantArgs {
269- fn ident ( & self ) -> Option < syn:: Ident > {
270- None
271- }
272- fn ty ( & self ) -> Option < syn:: Type > {
273- None
274- }
275- fn attrs ( & self ) -> & [ syn:: Attribute ] {
276- & self . attrs
277- }
278- fn index ( & self ) -> Option < usize > {
279- None
280- }
281- fn optional ( & self ) -> bool {
282- false
283- }
284- fn strategy ( & self ) -> Strategy {
285- Strategy :: None
286- }
287- fn class ( & self ) -> Option < AsType > {
288- match self . type_ . as_deref ( ) {
289- Some ( "vec" ) => Some ( AsType :: Vec ) ,
290- Some ( "map" ) => Some ( AsType :: Map ) ,
291- Some ( _) => Some ( AsType :: Other ) ,
292- None => None ,
293- }
294- }
295- fn borrow_lifetimes ( & self ) -> syn:: Result < Option < BTreeSet < Lifetime > > > {
296- unimplemented ! ( "Variant have not implemented borrow" )
297- }
298-
299- fn self_lifetime ( & self ) -> syn:: Result < BTreeSet < Lifetime > > {
300- unimplemented ! ( "Variant have not implemented self_lifetime" )
301- }
302-
303- fn has_borrow_lifetime ( & self ) -> bool {
304- false
305- }
306-
307- fn lifetime ( & self ) -> syn:: Result < BTreeSet < Lifetime > > {
308- unimplemented ! ( "Variant have not implemented borrow" )
309- }
310- }
311-
312240pub fn get_derive_args ( args : & [ NestedMeta ] ) -> syn:: Result < DeriveArgs > {
313241 match DeriveArgs :: from_list ( args) {
314242 Ok ( v) => Ok ( v) ,
@@ -448,8 +376,6 @@ fn collect_lifetimes(ty: &syn::Type, out: &mut BTreeSet<syn::Lifetime>) {
448376 | syn:: Type :: ImplTrait ( _)
449377 | syn:: Type :: Infer ( _)
450378 | syn:: Type :: Verbatim ( _) => { }
451-
452- #[ cfg_attr( all( test, exhaustive) , deny( non_exhaustive_omitted_patterns) ) ]
453379 _ => { }
454380 }
455381}
0 commit comments