docx_rs/documents/elements/
shape.rs1use serde::Serialize;
2
3#[derive(Serialize, Debug, Clone, PartialEq, Default)]
4#[cfg_attr(feature = "wasm", derive(ts_rs::TS))]
5#[cfg_attr(feature = "wasm", ts(export))]
6#[serde(rename_all = "camelCase")]
7pub struct Shape {
8 #[serde(skip_serializing_if = "Option::is_none")]
9 pub style: Option<String>,
10 #[serde(skip_serializing_if = "Option::is_none")]
11 pub image_data: Option<ImageData>,
12}
13#[derive(Serialize, Debug, Clone, PartialEq, Default)]
16#[cfg_attr(feature = "wasm", derive(ts_rs::TS))]
17#[cfg_attr(feature = "wasm", ts(export))]
18#[serde(rename_all = "camelCase")]
19pub struct ImageData {
20 pub id: String,
21}
22
23impl Shape {
24 pub fn new() -> Self {
25 Default::default()
26 }
27
28 pub fn style(mut self, style: impl Into<String>) -> Self {
29 self.style = Some(style.into());
30 self
31 }
32
33 pub fn image_data(mut self, id: impl Into<String>) -> Self {
34 self.image_data = Some(ImageData { id: id.into() });
35 self
36 }
37}
38
39