#[derive(Copy, Clone, Debug)]
pub struct ListOptions {
pub(crate) serial_comma: bool,
pub(crate) conjunction: &'static str,
pub(crate) separator: &'static str,
}
impl ListOptions {
#[inline]
pub const fn new() -> Self {
Self {
serial_comma: true,
conjunction: "and",
separator: ", ",
}
}
#[inline]
pub const fn serial_comma(mut self) -> Self {
self.serial_comma = true;
self
}
#[inline]
pub const fn serial_comma_enabled(mut self, enabled: bool) -> Self {
self.serial_comma = enabled;
self
}
#[inline]
pub const fn no_serial_comma(mut self) -> Self {
self.serial_comma = false;
self
}
#[inline]
pub const fn conjunction(mut self, word: &'static str) -> Self {
self.conjunction = word;
self
}
#[inline]
pub const fn separator(mut self, sep: &'static str) -> Self {
self.separator = sep;
self
}
}
impl Default for ListOptions {
#[inline]
fn default() -> Self {
Self::new()
}
}