#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct Tehta {
pub base: char,
pub alternate: Option<char>,
pub can_double: bool,
}
impl Tehta {
pub const fn single(base: char) -> Self {
Self { base, alternate: None, can_double: false }
}
pub const fn double(base: char) -> Self {
Self { base, alternate: None, can_double: true }
}
pub const fn altern(base: char, alt: char) -> Self {
Self { base, alternate: Some(alt), can_double: true }
}
pub const fn with_alt(mut self, alt: char) -> Self {
self.alternate = Some(alt);
self
}
pub const fn with_double(mut self) -> Self {
self.can_double = true;
self
}
pub const fn needs_ara(&self) -> bool {
!(self.can_double || self.alternate.is_some())
}
}