@@ -136,13 +136,23 @@ impl<'a> ExpandedName<'a> {
136
136
}
137
137
138
138
/// Returns the local name of this [`ExpandedName`].
139
- pub fn local_name ( & self ) -> & LocalName < ' _ > {
139
+ pub fn local_name ( & self ) -> & LocalName < ' a > {
140
140
& self . local_name
141
141
}
142
142
143
+ /// Returns a mutable reference to the local name of this [`ExpandedName`].
144
+ pub fn local_name_mut ( & mut self ) -> & mut LocalName < ' a > {
145
+ & mut self . local_name
146
+ }
147
+
143
148
/// Returns the namespace of this [`ExpandedName`].
144
- pub fn namespace ( & self ) -> Option < & XmlNamespace < ' _ > > {
145
- self . namespace . as_ref ( )
149
+ pub fn namespace ( & self ) -> & Option < XmlNamespace < ' a > > {
150
+ & self . namespace
151
+ }
152
+
153
+ /// Returns a mutable reference to the namespace of this [`ExpandedName`].
154
+ pub fn namespace_mut ( & mut self ) -> & mut Option < XmlNamespace < ' a > > {
155
+ & mut self . namespace
146
156
}
147
157
148
158
/// Converts this [`ExpandedName`] into a [`QName`] name using the given [`Prefix`].
@@ -210,14 +220,24 @@ impl<'a> QName<'a> {
210
220
}
211
221
212
222
/// Returns the [`Prefix`] of this [`QName`].
213
- pub fn prefix ( & self ) -> Option < & Prefix < ' a > > {
214
- self . prefix . as_ref ( )
223
+ pub fn prefix ( & self ) -> & Option < Prefix < ' a > > {
224
+ & self . prefix
225
+ }
226
+
227
+ /// Returns a mutable reference to the [`Prefix`] of this [`QName`].
228
+ pub fn prefix_mut ( & mut self ) -> & mut Option < Prefix < ' a > > {
229
+ & mut self . prefix
215
230
}
216
231
217
232
/// Returns the [`LocalName`] of this [`QName`].
218
233
pub fn local_name ( & self ) -> & LocalName < ' a > {
219
234
& self . local_name
220
235
}
236
+
237
+ /// Returns a mutable reference to the [`LocalName`] of this [`QName`].
238
+ pub fn local_name_mut ( & mut self ) -> & mut LocalName < ' a > {
239
+ & mut self . local_name
240
+ }
221
241
}
222
242
223
243
impl Display for QName < ' _ > {
@@ -571,7 +591,7 @@ mod tests {
571
591
let local_name = LocalName :: from_str ( local_name_text) . unwrap ( ) ;
572
592
let expanded_name = ExpandedName :: new ( local_name. clone ( ) , namespace. clone ( ) ) ;
573
593
assert_eq ! ( expanded_name. local_name( ) , & local_name) ;
574
- assert_eq ! ( expanded_name. namespace( ) , namespace. as_ref ( ) ) ;
594
+ assert_eq ! ( expanded_name. namespace( ) , & namespace) ;
575
595
assert_eq ! ( expanded_name. to_string( ) , local_name_text) ;
576
596
assert_eq ! ( expanded_name. into_owned( ) . to_string( ) , local_name_text) ;
577
597
}
0 commit comments