1#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
5pub enum QuoteStyle {
6 Single,
8 #[default]
10 Double,
11}
12
13#[derive(Debug, Clone, Copy, PartialEq, Eq)]
15pub enum IndentStyle {
16 Tabs,
18 Spaces(u8),
20}
21
22impl Default for IndentStyle {
23 fn default() -> Self {
24 IndentStyle::Spaces(2)
25 }
26}
27
28#[derive(Debug, Clone)]
30pub struct FormatOptions {
31 pub use_semicolons: bool,
33 pub quote_style: QuoteStyle,
35 pub indent: IndentStyle,
37 pub trailing_commas: bool,
39 pub line_width: usize,
41}
42
43impl Default for FormatOptions {
44 fn default() -> Self {
45 Self {
46 use_semicolons: true,
47 quote_style: QuoteStyle::default(),
48 indent: IndentStyle::default(),
49 trailing_commas: false,
50 line_width: 80,
51 }
52 }
53}
54
55impl FormatOptions {
56 pub fn fob_default() -> Self {
58 Self::default()
59 }
60
61 pub fn minified() -> Self {
63 Self {
64 use_semicolons: true,
65 quote_style: QuoteStyle::Double,
66 indent: IndentStyle::Spaces(0),
67 trailing_commas: false,
68 line_width: 0,
69 }
70 }
71}