#[derive(Clone, Copy, Debug)]
pub struct FormatOptions {
indent: usize,
space: char,
}
impl FormatOptions {
pub const fn new(indent: usize) -> Self {
Self { indent, space: ' ' }
}
pub fn tab() -> Self {
Self {
indent: 1,
space: '\t',
}
}
pub const fn indent(&self) -> usize {
self.indent
}
pub const fn space(self) -> char {
self.space
}
pub const fn set_indent(self, indent: usize) -> Self {
Self { indent, ..self }
}
pub const fn set_space(self, space: char) -> Self {
Self { space, ..self }
}
}