Use a BTreeMap<String, String> instead of a Vec<Attribute> to store attributes

This way we don't need to reimplement PartialEq for Element. It's also
way easier to get an attribute by name as we don't need to iterate over
every attribute to see if it exists.

The only side effect is that now, in the Debug output, attributes are
automatically sorted by names instead of being sorted by insertion
order.

Fixes #4
This commit is contained in:
Bastien Orivel 2017-04-26 23:44:58 +02:00
commit f87e2442d4
4 changed files with 29 additions and 95 deletions

View file

@ -67,13 +67,11 @@
extern crate xml;
pub mod error;
pub mod attribute;
pub mod element;
pub mod convert;
#[cfg(test)] mod tests;
pub use error::Error;
pub use attribute::Attribute;
pub use element::{Element, Node, Children, ChildrenMut, ElementBuilder};
pub use convert::{IntoElements, IntoAttributeValue};