use std::fmt;
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct FaceName {
pub feature: String,
pub face: String,
}
impl FaceName {
pub const START: &'static str = "start";
pub const END: &'static str = "end";
pub const SIDE: &'static str = "side";
pub(crate) fn all<'a>(
feature: &str,
names: impl IntoIterator<Item = &'a String>,
) -> Vec<FaceName> {
let names = names.into_iter();
names.map(|n| FaceName::new(feature, n.clone())).collect()
}
pub const INNER: &'static str = "inner";
pub fn new(feature: impl Into<String>, face: impl Into<String>) -> FaceName {
FaceName {
feature: feature.into(),
face: face.into(),
}
}
}
impl fmt::Display for FaceName {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}.{}", self.feature, self.face)
}
}