use regex::Regex;
#[derive(Debug, Clone)]
pub struct Options {
pub separator: String,
pub locale: Option<crate::Locale>,
pub remove: Option<Regex>,
pub lowercase: bool,
pub trim: bool,
pub max_length: Option<usize>,
pub drop_emoji: bool,
pub drop_apostrophes: bool,
}
impl Default for Options {
fn default() -> Self {
Self {
separator: "-".into(),
locale: None,
remove: None,
lowercase: true,
trim: true,
max_length: None,
drop_emoji: true,
drop_apostrophes: true,
}
}
}
impl Options {
pub fn separator(mut self, separator: impl Into<String>) -> Self {
self.separator = separator.into();
self
}
pub fn locale(mut self, locale: Option<crate::Locale>) -> Self {
self.locale = locale;
self
}
pub fn remove(mut self, remove: Option<Regex>) -> Self {
self.remove = remove;
self
}
pub fn lowercase(mut self, lowercase: bool) -> Self {
self.lowercase = lowercase;
self
}
pub fn trim(mut self, trim: bool) -> Self {
self.trim = trim;
self
}
pub fn max_length(mut self, max_length: Option<usize>) -> Self {
self.max_length = max_length;
self
}
pub fn drop_emoji(mut self, drop_emoji: bool) -> Self {
self.drop_emoji = drop_emoji;
self
}
pub fn drop_apostrophes(mut self, drop_apostrophes: bool) -> Self {
self.drop_apostrophes = drop_apostrophes;
self
}
}