From 3edc7026e4d6c27d8de77682fd00b2f45038fd55 Mon Sep 17 00:00:00 2001 From: Matt Bilker Date: Fri, 30 Aug 2019 07:04:25 +0000 Subject: [PATCH] node: add ability to remove attributes --- src/node/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/node/mod.rs b/src/node/mod.rs index e417c4c..37bf6b8 100644 --- a/src/node/mod.rs +++ b/src/node/mod.rs @@ -199,6 +199,10 @@ impl Node { attributes.insert(key.into(), value.into()) } + pub fn remove_attr(&mut self, key: &str) -> Option { + self.attributes.as_mut().and_then(|attributes| attributes.remove(key)) + } + pub fn sort_attrs(&mut self) { if let Some(ref mut attributes) = self.attributes { attributes.sort_keys();