qr_code_styling/config/
dot_options.rs1use super::{Color, Gradient};
4use crate::types::DotType;
5
6#[derive(Debug, Clone, PartialEq)]
8#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
9pub struct DotsOptions {
10 pub dot_type: DotType,
12 pub color: Color,
14 pub gradient: Option<Gradient>,
16 pub round_size: bool,
18}
19
20impl Default for DotsOptions {
21 fn default() -> Self {
22 Self {
23 dot_type: DotType::Square,
24 color: Color::BLACK,
25 gradient: None,
26 round_size: true,
27 }
28 }
29}
30
31impl DotsOptions {
32 pub fn new(dot_type: DotType) -> Self {
34 Self {
35 dot_type,
36 ..Default::default()
37 }
38 }
39
40 pub fn with_type(mut self, dot_type: DotType) -> Self {
42 self.dot_type = dot_type;
43 self
44 }
45
46 pub fn with_color(mut self, color: Color) -> Self {
48 self.color = color;
49 self
50 }
51
52 pub fn with_gradient(mut self, gradient: Gradient) -> Self {
54 self.gradient = Some(gradient);
55 self
56 }
57
58 pub fn with_round_size(mut self, round_size: bool) -> Self {
60 self.round_size = round_size;
61 self
62 }
63}