rustical_xml/
lib.rs

1use quick_xml::name::Namespace;
2use std::collections::HashMap;
3use std::hash::Hash;
4use std::str::FromStr;
5
6pub mod de;
7mod error;
8mod namespace;
9pub mod se;
10mod unparsed;
11mod value;
12
13pub use de::XmlDeserialize;
14pub use de::XmlDocument;
15pub use error::XmlError;
16pub use namespace::NamespaceOwned;
17pub use se::XmlSerialize;
18pub use se::XmlSerializeRoot;
19pub use unparsed::Unparsed;
20pub use value::{ParseValueError, ValueDeserialize, ValueSerialize};
21pub use xml_derive::EnumVariants;
22pub use xml_derive::PropName;
23pub use xml_derive::XmlRootTag;
24
25pub trait XmlRootTag {
26    fn root_tag() -> &'static [u8];
27    fn root_ns() -> Option<Namespace<'static>>;
28    fn root_ns_prefixes() -> HashMap<Namespace<'static>, &'static [u8]>;
29}
30
31#[derive(Debug)]
32pub struct FromStrError;
33
34pub trait EnumVariants {
35    const TAGGED_VARIANTS: &'static [(Option<Namespace<'static>>, &'static str)];
36
37    // Returns all valid xml names including untagged variants
38    fn variant_names() -> Vec<(Option<Namespace<'static>>, &'static str)>;
39}
40
41pub trait PropName: Sized {
42    type Names: Into<(Option<Namespace<'static>>, &'static str)>
43        + Clone
44        + Send
45        + Sync
46        + From<Self>
47        + FromStr<Err: std::fmt::Debug>
48        + Hash
49        + Eq
50        + XmlDeserialize;
51}