#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum QuoteStyle {
Single,
#[default]
Double,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum IndentStyle {
Tabs,
Spaces(u8),
}
impl Default for IndentStyle {
fn default() -> Self {
IndentStyle::Spaces(2)
}
}
#[derive(Debug, Clone)]
pub struct FormatOptions {
pub use_semicolons: bool,
pub quote_style: QuoteStyle,
pub indent: IndentStyle,
pub trailing_commas: bool,
pub line_width: usize,
}
impl Default for FormatOptions {
fn default() -> Self {
Self {
use_semicolons: true,
quote_style: QuoteStyle::default(),
indent: IndentStyle::default(),
trailing_commas: false,
line_width: 80,
}
}
}
impl FormatOptions {
pub fn fob_default() -> Self {
Self::default()
}
pub fn minified() -> Self {
Self {
use_semicolons: true,
quote_style: QuoteStyle::Double,
indent: IndentStyle::Spaces(0),
trailing_commas: false,
line_width: 0,
}
}
}