pub trait XmlTree: Sized {
Show 14 methods
// Required methods
fn tag(&self) -> Option<String>;
fn attribute(&self, name: &str) -> Option<String>;
fn set_attribute(&mut self, name: &str, value: &str) -> Result<()>;
fn text(&self) -> Option<String>;
fn set_text(&mut self, text: &str) -> Result<()>;
fn len(&self) -> usize;
fn child(&self, index: usize) -> Option<Self>;
fn with_child<R>(
&mut self,
index: usize,
change: impl FnOnce(&mut Self) -> R,
) -> Option<R>;
fn insert(&mut self, index: usize, child: Self) -> Result<()>;
fn remove(&mut self, index: usize) -> Result<()>;
fn element(&self, tag: &str) -> Result<Self>;
fn comment(&self, text: &str) -> Result<Self>;
fn deep_copy(&self) -> Result<Self>;
// Provided method
fn is_empty(&self) -> bool { ... }
}Available on crate feature
musicxml only.Expand description
An XML element the joining steps can read and change: its tag, attributes, text and children, counted as ElementTree counts them, comments included.
XmlTree::child hands back a child to read. What it hands back may be
a copy, so a child is changed through XmlTree::with_child.
Required Methods§
Sourcefn with_child<R>(
&mut self,
index: usize,
change: impl FnOnce(&mut Self) -> R,
) -> Option<R>
fn with_child<R>( &mut self, index: usize, change: impl FnOnce(&mut Self) -> R, ) -> Option<R>
Runs change on the child at an index, where it is an element.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".