@@ -10,7 +10,7 @@ use crate::{
1010 Codegen , Result , Runner ,
1111 output:: { Output , output_path} ,
1212 parse:: attr:: { AttrLocation , AttrPart , AttrPositions , attr_positions} ,
13- schema:: { Def , Derives , EnumDef , FileId , Schema , StructDef , TypeDef , TypeId } ,
13+ schema:: { Def , FileId , Schema , StructOrEnum , TypeDef } ,
1414 utils:: format_cow,
1515} ;
1616
@@ -265,63 +265,3 @@ macro_rules! define_derive {
265265 } ;
266266}
267267pub ( crate ) use define_derive;
268-
269- /// Reference to a [`StructDef`] or [`EnumDef`].
270- ///
271- /// This type is what's passed to [`Derive::derive`] method.
272- #[ derive( Clone , Copy ) ]
273- pub enum StructOrEnum < ' d > {
274- Struct ( & ' d StructDef ) ,
275- Enum ( & ' d EnumDef ) ,
276- }
277-
278- impl Def for StructOrEnum < ' _ > {
279- /// Get [`TypeId`] for type.
280- fn id ( & self ) -> TypeId {
281- match self {
282- Self :: Struct ( struct_def) => struct_def. id ( ) ,
283- Self :: Enum ( enum_def) => enum_def. id ( ) ,
284- }
285- }
286-
287- /// Get type name.
288- fn name ( & self ) -> & str {
289- match self {
290- Self :: Struct ( struct_def) => struct_def. name ( ) ,
291- Self :: Enum ( enum_def) => enum_def. name ( ) ,
292- }
293- }
294-
295- /// Get all traits which have derives generated for this type.
296- fn generated_derives ( & self ) -> Derives {
297- match self {
298- Self :: Struct ( struct_def) => struct_def. generated_derives ( ) ,
299- Self :: Enum ( enum_def) => enum_def. generated_derives ( ) ,
300- }
301- }
302-
303- /// Get if type has a lifetime.
304- fn has_lifetime ( & self , schema : & Schema ) -> bool {
305- match self {
306- Self :: Struct ( struct_def) => struct_def. has_lifetime ( schema) ,
307- Self :: Enum ( enum_def) => enum_def. has_lifetime ( schema) ,
308- }
309- }
310-
311- /// Get type signature (including lifetimes).
312- /// Lifetimes are anonymous (`'_`) if `anon` is true.
313- fn ty_with_lifetime ( & self , schema : & Schema , anon : bool ) -> TokenStream {
314- match self {
315- Self :: Struct ( struct_def) => struct_def. ty_with_lifetime ( schema, anon) ,
316- Self :: Enum ( enum_def) => enum_def. ty_with_lifetime ( schema, anon) ,
317- }
318- }
319-
320- /// Get inner type, if type has one.
321- ///
322- /// Structs and enums don't have a single inner type, so returns `None`.
323- #[ expect( unused_variables) ]
324- fn maybe_inner_type < ' s > ( & self , schema : & ' s Schema ) -> Option < & ' s TypeDef > {
325- None
326- }
327- }
0 commit comments