#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum ArgAtom {
FixtureLocal { name: String },
ConstLit { text: String },
ConstPath { def_path: String },
Unsupported,
}
impl ArgAtom {
#[must_use]
pub fn fixture_local(name: impl Into<String>) -> Self {
Self::FixtureLocal { name: name.into() }
}
#[must_use]
pub fn const_lit(text: impl Into<String>) -> Self {
Self::ConstLit { text: text.into() }
}
#[must_use]
pub fn const_path(def_path: impl Into<String>) -> Self {
Self::ConstPath {
def_path: def_path.into(),
}
}
#[must_use]
pub const fn unsupported() -> Self {
Self::Unsupported
}
}
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
pub struct ArgFingerprint {
atoms: Vec<ArgAtom>,
}
impl ArgFingerprint {
#[must_use]
pub fn new<I>(atoms: I) -> Self
where
I: IntoIterator<Item = ArgAtom>,
{
Self {
atoms: atoms.into_iter().collect(),
}
}
#[must_use]
pub fn atoms(&self) -> &[ArgAtom] {
&self.atoms
}
#[must_use]
pub fn into_atoms(self) -> Vec<ArgAtom> {
self.atoms
}
}