1- use std:: collections:: HashMap ;
1+ use std:: collections:: BTreeMap ;
22use std:: io:: Write ;
33use std:: str;
44
@@ -11,7 +11,7 @@ use crate::toxml::ToXml;
1111pub ( crate ) mod util;
1212
1313/// A map of extension namespace prefixes to local names to elements.
14- pub type ExtensionMap = HashMap < String , HashMap < String , Vec < Extension > > > ;
14+ pub type ExtensionMap = BTreeMap < String , BTreeMap < String , Vec < Extension > > > ;
1515
1616/// A namespaced extension.
1717#[ cfg_attr( feature = "serde" , derive( Deserialize , Serialize ) ) ]
@@ -32,10 +32,10 @@ pub struct Extension {
3232 pub value : Option < String > ,
3333 /// The attributes for the extension element.
3434 #[ cfg_attr( feature = "builders" , builder( setter( each = "attr" ) ) ) ]
35- pub attrs : HashMap < String , String > ,
35+ pub attrs : BTreeMap < String , String > ,
3636 /// The children of the extension element. A map of local names to child elements.
3737 #[ cfg_attr( feature = "builders" , builder( setter( each = "child" ) ) ) ]
38- pub children : HashMap < String , Vec < Extension > > ,
38+ pub children : BTreeMap < String , Vec < Extension > > ,
3939}
4040
4141impl Extension {
@@ -108,16 +108,16 @@ impl Extension {
108108 /// # Examples
109109 ///
110110 /// ```
111- /// use std::collections::HashMap ;
111+ /// use std::collections::BTreeMap ;
112112 /// use atom_syndication::extension::Extension;
113113 ///
114114 /// let mut extension = Extension::default();
115- /// let mut attrs = HashMap ::<String, String>::new();
115+ /// let mut attrs = BTreeMap ::<String, String>::new();
116116 /// attrs.insert("email".to_string(), "johndoe@example.com".to_string());
117117 /// extension.set_attrs(attrs.clone());
118118 /// assert_eq!(*extension.attrs(), attrs);
119119 /// ```
120- pub fn attrs ( & self ) -> & HashMap < String , String > {
120+ pub fn attrs ( & self ) -> & BTreeMap < String , String > {
121121 & self . attrs
122122 }
123123
@@ -126,15 +126,15 @@ impl Extension {
126126 /// # Examples
127127 ///
128128 /// ```
129- /// use std::collections::HashMap ;
129+ /// use std::collections::BTreeMap ;
130130 /// use atom_syndication::extension::Extension;
131131 ///
132132 /// let mut extension = Extension::default();
133- /// extension.set_attrs(HashMap ::new());
133+ /// extension.set_attrs(BTreeMap ::new());
134134 /// ```
135135 pub fn set_attrs < V > ( & mut self , attrs : V )
136136 where
137- V : Into < HashMap < String , String > > ,
137+ V : Into < BTreeMap < String , String > > ,
138138 {
139139 self . attrs = attrs. into ( ) ;
140140 }
@@ -146,16 +146,16 @@ impl Extension {
146146 /// # Examples
147147 ///
148148 /// ```
149- /// use std::collections::HashMap ;
149+ /// use std::collections::BTreeMap ;
150150 /// use atom_syndication::extension::Extension;
151151 ///
152152 /// let mut extension = Extension::default();
153- /// let mut children = HashMap ::<String, Vec<Extension>>::new();
153+ /// let mut children = BTreeMap ::<String, Vec<Extension>>::new();
154154 /// children.insert("ext:child".to_string(), Vec::new());
155155 /// extension.set_children(children);
156156 /// assert!(extension.children().contains_key("ext:child"));
157157 /// ```
158- pub fn children ( & self ) -> & HashMap < String , Vec < Extension > > {
158+ pub fn children ( & self ) -> & BTreeMap < String , Vec < Extension > > {
159159 & self . children
160160 }
161161
@@ -166,15 +166,15 @@ impl Extension {
166166 /// # Examples
167167 ///
168168 /// ```
169- /// use std::collections::HashMap ;
169+ /// use std::collections::BTreeMap ;
170170 /// use atom_syndication::extension::Extension;
171171 ///
172172 /// let mut extension = Extension::default();
173- /// extension.set_children(HashMap ::new());
173+ /// extension.set_children(BTreeMap ::new());
174174 /// ```
175175 pub fn set_children < V > ( & mut self , children : V )
176176 where
177- V : Into < HashMap < String , Vec < Extension > > > ,
177+ V : Into < BTreeMap < String , Vec < Extension > > > ,
178178 {
179179 self . children = children. into ( ) ;
180180 }
0 commit comments