xso-proc: introduce trait for StructDef
Can you see it coming?
This commit is contained in:
parent
dc88d1fb29
commit
3a56b2bb10
3 changed files with 69 additions and 33 deletions
|
|
@ -25,6 +25,7 @@ use proc_macro2::{Span, TokenStream};
|
|||
use quote::quote;
|
||||
use syn::*;
|
||||
|
||||
mod common;
|
||||
mod compound;
|
||||
mod error_message;
|
||||
mod field;
|
||||
|
|
@ -34,6 +35,8 @@ mod state;
|
|||
mod structs;
|
||||
mod types;
|
||||
|
||||
use common::{AsXmlParts, FromXmlParts, ItemDef};
|
||||
|
||||
/// Convert an [`syn::Item`] into the parts relevant for us.
|
||||
///
|
||||
/// If the item is of an unsupported variant, an appropriate error is
|
||||
|
|
@ -57,7 +60,7 @@ fn from_xml_impl(input: Item) -> Result<TokenStream> {
|
|||
let name_ident = Ident::new("name", Span::call_site());
|
||||
let attrs_ident = Ident::new("attrs", Span::call_site());
|
||||
|
||||
let structs::FromXmlParts {
|
||||
let FromXmlParts {
|
||||
defs,
|
||||
from_events_body,
|
||||
builder_ty_ident,
|
||||
|
|
@ -116,7 +119,7 @@ pub fn from_xml(input: RawTokenStream) -> RawTokenStream {
|
|||
fn as_xml_impl(input: Item) -> Result<TokenStream> {
|
||||
let (vis, ident, def) = parse_struct(input)?;
|
||||
|
||||
let structs::AsXmlParts {
|
||||
let AsXmlParts {
|
||||
defs,
|
||||
as_xml_iter_body,
|
||||
item_iter_ty_lifetime,
|
||||
|
|
|
|||
Loading…
Reference in a new issue