use regex_cache::CachedRegex;
#[derive(Clone, Debug)]
pub struct Format {
pub(crate) pattern: CachedRegex,
pub(crate) format: String,
pub(crate) leading_digits: Vec<CachedRegex>,
pub(crate) national_prefix: Option<String>,
pub(crate) national_prefix_optional: bool,
pub(crate) domestic_carrier: Option<String>,
}
impl Format {
pub fn pattern(&self) -> &CachedRegex {
&self.pattern
}
pub fn format(&self) -> &str {
&self.format
}
pub fn leading_digits(&self) -> &[CachedRegex] {
&self.leading_digits
}
pub fn national_prefix(&self) -> Option<&str> {
self.national_prefix.as_ref().map(AsRef::as_ref)
}
pub fn is_national_prefix_optional(&self) -> bool {
self.national_prefix_optional
}
pub fn domestic_carrier(&self) -> Option<&str> {
self.domestic_carrier.as_ref().map(AsRef::as_ref)
}
}