use anyhow::bail;
use quick_xml::events::BytesStart;
#[derive(Debug, Clone, PartialEq)]
pub struct XlsxDrawing {
pub id: String,
}
impl XlsxDrawing {
pub(crate) fn load(e: &BytesStart) -> anyhow::Result<Self> {
let attributes = e.attributes();
for a in attributes {
match a {
Ok(a) => {
let string_value = String::from_utf8(a.value.to_vec())?;
match a.key.local_name().as_ref() {
b"id" => return Ok(Self { id: string_value }),
_ => {}
}
}
Err(error) => {
bail!(error.to_string())
}
}
}
bail!("id not specified for the drawing.")
}
}