use crate::lang::Lang;
#[derive(Debug, Clone, Copy)]
pub enum Indentation {
Space(usize),
Tab,
}
#[derive(Debug, Clone)]
pub struct Config {
pub(super) indentation: Indentation,
pub(super) newline: &'static str,
}
impl Config {
pub fn from_lang<L>() -> Self
where
L: Lang,
{
Self {
indentation: L::default_indentation(),
newline: "\n",
}
}
pub fn with_indentation(self, indentation: Indentation) -> Self {
Self {
indentation,
..self
}
}
pub fn with_newline(self, newline: &'static str) -> Self {
Self { newline, ..self }
}
}