use std::fmt;
use super::index::{HeadAtomIndex, HeadDisjunctIndex};
#[derive(
Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize,
)]
#[serde(deny_unknown_fields)]
pub struct HeadAtomPath {
disjunct: HeadDisjunctIndex,
atom: HeadAtomIndex,
}
impl HeadAtomPath {
#[must_use]
pub const fn new(disjunct: HeadDisjunctIndex, atom: HeadAtomIndex) -> Self {
Self { disjunct, atom }
}
#[must_use]
pub const fn atomic() -> Self {
Self::new(HeadDisjunctIndex::new(0), HeadAtomIndex::new(0))
}
#[must_use]
pub const fn disjunct(self) -> HeadDisjunctIndex {
self.disjunct
}
#[must_use]
pub const fn atom(self) -> HeadAtomIndex {
self.atom
}
}
impl fmt::Display for HeadAtomPath {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"head disjunct {} atom {}",
self.disjunct.get(),
self.atom.get()
)
}
}