diff --git a/instant-xml-macros/src/de.rs b/instant-xml-macros/src/de.rs index 281ceba..2b0e6df 100644 --- a/instant-xml-macros/src/de.rs +++ b/instant-xml-macros/src/de.rs @@ -260,8 +260,8 @@ impl Deserializer { match def_prefix { Some(def_prefix) => { // Check if defined and gotten namespaces equals for each field - if deserializer.get_parser_namespace(&parser_prefix) - != deserializer.get_def_namespace(def_prefix) { + if deserializer.parser_namespace(&parser_prefix) + != deserializer.default_namespace(def_prefix) { return Err(Error::WrongNamespace) } } diff --git a/instant-xml/src/lib.rs b/instant-xml/src/lib.rs index aa6fdb9..71e7787 100644 --- a/instant-xml/src/lib.rs +++ b/instant-xml/src/lib.rs @@ -236,12 +236,12 @@ impl<'xml> Deserializer<'xml> { self.parser.peek_next_tag() } - pub fn get_def_namespace(&self, prefix: &str) -> Option<&&str> { - self.def_namespaces.get(prefix) + pub fn default_namespace(&self, prefix: &str) -> Option<&str> { + self.def_namespaces.get(prefix).map(|&ns| ns) } - pub fn get_parser_namespace(&self, prefix: &str) -> Option<&&str> { - self.parser_namespaces.get(prefix) + pub fn parser_namespace(&self, prefix: &str) -> Option<&str> { + self.parser_namespaces.get(prefix).map(|&ns| ns) } pub fn compare_parser_and_def_default_namespaces(&self) -> bool {