docx_reader/documents/elements/
shape.rs

1use serde::Serialize;
2
3#[derive(Serialize, Debug, Clone, PartialEq, Default)]
4#[serde(rename_all = "camelCase")]
5pub struct Shape {
6	#[serde(skip_serializing_if = "Option::is_none")]
7	pub style: Option<String>,
8	#[serde(skip_serializing_if = "Option::is_none")]
9	pub image_data: Option<ImageData>,
10}
11// Experimental, For now reader only.
12
13#[derive(Serialize, Debug, Clone, PartialEq, Default)]
14#[serde(rename_all = "camelCase")]
15pub struct ImageData {
16	pub id: String,
17}
18
19impl Shape {
20	pub fn new() -> Self {
21		Default::default()
22	}
23
24	pub fn style(mut self, style: impl Into<String>) -> Self {
25		self.style = Some(style.into());
26		self
27	}
28
29	pub fn image_data(mut self, id: impl Into<String>) -> Self {
30		self.image_data = Some(ImageData { id: id.into() });
31		self
32	}
33}
34
35// impl BuildXML for Shape {
36//     fn build(&self) -> Vec<u8> {
37//         let b = XMLBuilder::new();
38//         let mut b = b.open_pict();
39//         b = b.add_child(t),
40//         b.close().build()
41//     }
42// }