xso: add support for overriding names of generated types
In 1265f4b, we introduced a change which may cause a conflict of type
names when deriving the traits on two different types. While a
workaround existed (use `mod`s to isolate the implementation), that is
ugly.
This commit allows overriding the choice of type names.
This commit is contained in:
parent
eb51b05c13
commit
c90752aa51
5 changed files with 77 additions and 12 deletions
|
|
@ -85,13 +85,23 @@ impl StructDef {
|
|||
return Err(Error::new(meta.span, "`name` is required on structs"));
|
||||
};
|
||||
|
||||
let builder_ty_ident = match meta.builder {
|
||||
Some(v) => v,
|
||||
None => concat_camel_case(ident, "FromXmlBuilder"),
|
||||
};
|
||||
|
||||
let item_iter_ty_ident = match meta.iterator {
|
||||
Some(v) => v,
|
||||
None => concat_camel_case(ident, "AsXmlIterator"),
|
||||
};
|
||||
|
||||
Ok(Self {
|
||||
namespace,
|
||||
name,
|
||||
inner: Compound::from_fields(fields)?,
|
||||
target_ty_ident: ident.clone(),
|
||||
builder_ty_ident: concat_camel_case(ident, "FromXmlBuilder"),
|
||||
item_iter_ty_ident: concat_camel_case(ident, "AsXmlIterator"),
|
||||
builder_ty_ident,
|
||||
item_iter_ty_ident,
|
||||
debug: meta.debug.is_set(),
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue