macro_rules! prefixes {
($($name:ident $(as $prefix:literal)?),* $(,)?) => { ... };
}Expand description
Writes the prefixes of namespaces defined by namespace!.
Every namespace has the name of its macro as prefix unless another one
is given with as. The result is the table for
SerializerConfig::namespaces and
DeserializerConfig::namespaces:
use deser_xml::{DeserializerConfig, SerializerConfig, prefixes};
deser_xml::namespace!(
atom = "http://www.w3.org/2005/Atom",
dc = "http://purl.org/dc/elements/1.1/",
xlink = "http://www.w3.org/1999/xlink",
);
const PREFIXES: &[(&str, &str)] =
prefixes![atom as "", dc, xlink as "xl"];
assert_eq!(PREFIXES, [
("", "http://www.w3.org/2005/Atom"),
("dc", "http://purl.org/dc/elements/1.1/"),
("xl", "http://www.w3.org/1999/xlink"),
]);
const WRITE: SerializerConfig =
SerializerConfig::new().namespaces(PREFIXES);
const READ: DeserializerConfig =
DeserializerConfig::new().namespaces(PREFIXES);