docx_reader/documents/elements/
text_border.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use serde::{Deserialize, Serialize};

use crate::types::*;

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TextBorder {
	pub border_type: BorderType,
	pub size: usize,
	pub color: String,
	pub space: usize,
}

impl TextBorder {
	pub fn new() -> Self {
		TextBorder::default()
	}

	pub fn color(mut self, color: impl Into<String>) -> Self {
		self.color = color.into();
		self
	}

	pub fn size(mut self, size: usize) -> Self {
		self.size = size;
		self
	}

	pub fn space(mut self, space: usize) -> Self {
		self.space = space;
		self
	}

	pub fn border_type(mut self, border_type: BorderType) -> Self {
		self.border_type = border_type;
		self
	}
}

impl Default for TextBorder {
	fn default() -> Self {
		TextBorder {
			border_type: BorderType::Single,
			size: 4,
			space: 0,
			color: "auto".to_owned(),
		}
	}
}