mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-23 09:08:12 +08:00
Add struct field visualization to the editor message hierarchy tree visualization on the website (#2917)
* Fix Message Tree: Enforce Structure and Visibility * Code review * fix the erroreous ouputs * error handling for MessageHandler * Fix website visualization HTML generation * error handling for tuple-style message enum variant * cleanup * Update messages * Normalize BroadcastEvent --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
5ed45ead6f
commit
17d70dc60e
@@ -31,23 +31,23 @@ pub fn derive_extract_field_impl(input: TokenStream) -> syn::Result<TokenStream>
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let field_str = field_info.into_iter().map(|(name, ty)| (format!("{}: {}", name, ty)));
|
||||
let field_str = field_info.into_iter().map(|(name, ty)| (format!("{name}: {ty}")));
|
||||
|
||||
let res = quote! {
|
||||
impl #impl_generics #struct_name #ty_generics #where_clause {
|
||||
pub fn field_types() -> Vec<(String, usize)> {
|
||||
impl #impl_generics ExtractField for #struct_name #ty_generics #where_clause {
|
||||
fn field_types() -> Vec<(String, usize)> {
|
||||
vec![
|
||||
#((String::from(#field_str), #field_line)),*
|
||||
]
|
||||
}
|
||||
|
||||
pub fn print_field_types() {
|
||||
fn print_field_types() {
|
||||
for (field, line) in Self::field_types() {
|
||||
println!("{} at line {}", field, line);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn path() -> &'static str {
|
||||
fn path() -> &'static str {
|
||||
file!()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user