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:
parent
2aef4aacb8
commit
f87e2442d4
4 changed files with 29 additions and 95 deletions
|
|
@ -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};
|
||||
|
|
|
|||
Loading…
Reference in a new issue