Fix support for attributes with no default namespace fallback
This commit is contained in:
parent
b30859929b
commit
f64634155e
|
@ -122,7 +122,10 @@ fn process_named_field(
|
|||
)
|
||||
.into_compile_error(),
|
||||
),
|
||||
None => (quote!(#default_ns), quote!()),
|
||||
None => (match default_ns {
|
||||
Some(ns) => quote!(#ns),
|
||||
None => quote!(""),
|
||||
}, quote!()),
|
||||
};
|
||||
|
||||
attributes.extend(quote!(
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
use similar_asserts::assert_eq;
|
||||
|
||||
use instant_xml::{from_str, to_string, FromXml, ToXml};
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, FromXml, ToXml)]
|
||||
struct Basic {
|
||||
#[xml(attribute)]
|
||||
flag: bool,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn basic() {
|
||||
assert_eq!(
|
||||
from_str::<Basic>("<Basic flag=\"true\"></Basic>"),
|
||||
Ok(Basic { flag: true })
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
to_string(&Basic { flag: true }).unwrap(),
|
||||
"<Basic flag=\"true\"></Basic>"
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue