@@ -111,13 +111,21 @@ fn derive_enum(enum_attributes: &[Attribute], name: Ident, input: syn::DataEnum)
111111 } )
112112 . collect ( ) ;
113113
114- let crate_name = proc_macro_crate:: crate_name ( "graphene-core" )
115- . map_err ( |e| syn:: Error :: new ( Span :: call_site ( ) , format ! ( "Failed to find location of graphene_core. Make sure it is imported as a dependency: {}" , e) ) ) ?;
116- let crate_name = match crate_name {
117- proc_macro_crate:: FoundCrate :: Itself => quote ! ( crate ) ,
118- proc_macro_crate:: FoundCrate :: Name ( name) => {
119- let identifier = Ident :: new ( & name, Span :: call_site ( ) ) ;
120- quote ! { #identifier }
114+ let crate_name = {
115+ let crate_name = proc_macro_crate:: crate_name ( "graphene-core-shaders" )
116+ . or_else ( |_e| proc_macro_crate:: crate_name ( "graphene-core" ) )
117+ . map_err ( |e| {
118+ syn:: Error :: new (
119+ Span :: call_site ( ) ,
120+ format ! ( "Failed to find location of 'graphene_core' or 'graphene-core-shaders'. Make sure it is imported as a dependency: {}" , e) ,
121+ )
122+ } ) ?;
123+ match crate_name {
124+ proc_macro_crate:: FoundCrate :: Itself => quote ! ( crate ) ,
125+ proc_macro_crate:: FoundCrate :: Name ( name) => {
126+ let identifier = Ident :: new ( & name, Span :: call_site ( ) ) ;
127+ quote ! { #identifier }
128+ }
121129 }
122130 } ;
123131
@@ -140,19 +148,19 @@ fn derive_enum(enum_attributes: &[Attribute], name: Ident, input: syn::DataEnum)
140148 let docstring = match & variant. basic_item . description {
141149 Some ( s) => {
142150 let s = s. trim ( ) ;
143- quote ! { Some ( :: std :: borrow :: Cow :: Borrowed ( #s ) ) }
151+ quote ! { Some ( #s ) }
144152 }
145153 None => quote ! { None } ,
146154 } ;
147155 let icon = match & variant. basic_item . icon {
148- Some ( s) => quote ! { Some ( :: std :: borrow :: Cow :: Borrowed ( #s ) ) } ,
156+ Some ( s) => quote ! { Some ( #s ) } ,
149157 None => quote ! { None } ,
150158 } ;
151159 quote ! {
152160 (
153- #name:: #vname, #crate_name:: registry :: VariantMetadata {
154- name: :: std :: borrow :: Cow :: Borrowed ( #vname_str) ,
155- label: :: std :: borrow :: Cow :: Borrowed ( #label) ,
161+ #name:: #vname, #crate_name:: choice_type :: VariantMetadata {
162+ name: #vname_str,
163+ label: #label,
156164 docstring: #docstring,
157165 icon: #icon,
158166 }
@@ -174,10 +182,10 @@ fn derive_enum(enum_attributes: &[Attribute], name: Ident, input: syn::DataEnum)
174182 }
175183 }
176184
177- impl #crate_name:: registry :: ChoiceTypeStatic for #name {
178- const WIDGET_HINT : #crate_name:: registry :: ChoiceWidgetHint = #crate_name:: registry :: ChoiceWidgetHint :: #widget_hint;
185+ impl #crate_name:: choice_type :: ChoiceTypeStatic for #name {
186+ const WIDGET_HINT : #crate_name:: choice_type :: ChoiceWidgetHint = #crate_name:: choice_type :: ChoiceWidgetHint :: #widget_hint;
179187 const DESCRIPTION : Option <& ' static str > = #enum_description;
180- fn list( ) -> & ' static [ & ' static [ ( Self , #crate_name:: registry :: VariantMetadata ) ] ] {
188+ fn list( ) -> & ' static [ & ' static [ ( Self , #crate_name:: choice_type :: VariantMetadata ) ] ] {
181189 & [ #( #group) * ]
182190 }
183191 }
0 commit comments