Skip to content

Commit b3a2cbb

Browse files
committed
remove external_type_uuid macro (#4018)
# Objective - Macro `external_type_uuid` seems unused - https://docs.rs/bevy/latest/bevy/reflect/macro.external_type_uuid.html ## Solution - Remove it and see if it was? There is a derive for the same trait that is used everywhere (`#[derive(TypeUuid)]`) and is a better api
1 parent e4203c3 commit b3a2cbb

File tree

2 files changed

+1
-41
lines changed

2 files changed

+1
-41
lines changed

crates/bevy_reflect/bevy_reflect_derive/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -732,11 +732,6 @@ pub fn type_uuid_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStre
732732
type_uuid::type_uuid_derive(input)
733733
}
734734

735-
#[proc_macro]
736-
pub fn external_type_uuid(tokens: proc_macro::TokenStream) -> proc_macro::TokenStream {
737-
type_uuid::external_type_uuid(tokens)
738-
}
739-
740735
#[proc_macro_attribute]
741736
pub fn reflect_trait(args: TokenStream, input: TokenStream) -> TokenStream {
742737
reflect_trait::reflect_trait(&args, input)

crates/bevy_reflect/bevy_reflect_derive/src/type_uuid.rs

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ extern crate proc_macro;
22

33
use bevy_macro_utils::BevyManifest;
44
use quote::{quote, ToTokens};
5-
use syn::{parse::*, *};
5+
use syn::*;
66
use uuid::Uuid;
77

88
pub fn type_uuid_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
@@ -65,38 +65,3 @@ pub fn type_uuid_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStre
6565
};
6666
gen.into()
6767
}
68-
69-
struct ExternalDeriveInput {
70-
path: ExprPath,
71-
uuid_str: LitStr,
72-
}
73-
74-
impl Parse for ExternalDeriveInput {
75-
fn parse(input: ParseStream) -> Result<Self> {
76-
let path = input.parse()?;
77-
input.parse::<Token![,]>()?;
78-
let uuid_str = input.parse()?;
79-
Ok(Self { path, uuid_str })
80-
}
81-
}
82-
83-
pub fn external_type_uuid(tokens: proc_macro::TokenStream) -> proc_macro::TokenStream {
84-
let ExternalDeriveInput { path, uuid_str } = parse_macro_input!(tokens as ExternalDeriveInput);
85-
86-
let uuid = Uuid::parse_str(&uuid_str.value()).expect("Value was not a valid UUID.");
87-
88-
let bytes = uuid
89-
.as_bytes()
90-
.iter()
91-
.map(|byte| format!("{:#X}", byte))
92-
.map(|byte_str| syn::parse_str::<LitInt>(&byte_str).unwrap());
93-
94-
let gen = quote! {
95-
impl crate::TypeUuid for #path {
96-
const TYPE_UUID: Uuid = uuid::Uuid::from_bytes([
97-
#( #bytes ),*
98-
]);
99-
}
100-
};
101-
gen.into()
102-
}

0 commit comments

Comments
 (0)