use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
macro_rules! id_type {
($(#[$meta:meta])* $name:ident) => {
$(#[$meta])*
#[derive(
Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, JsonSchema,
)]
#[serde(transparent)]
pub struct $name(pub String);
impl $name {
pub fn as_str(&self) -> &str {
&self.0
}
}
impl std::fmt::Display for $name {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(&self.0)
}
}
impl<S: Into<String>> From<S> for $name {
fn from(value: S) -> Self {
$name(value.into())
}
}
};
}
id_type!(
BodyId
);
id_type!(
RegionId
);
id_type!(
ShellId
);
id_type!(
FaceId
);
id_type!(
LoopId
);
id_type!(
CoedgeId
);
id_type!(
EdgeId
);
id_type!(
VertexId
);
id_type!(
SurfaceId
);
id_type!(
CurveId
);
id_type!(
PcurveId
);
id_type!(
ProceduralSurfaceId
);
id_type!(
ProceduralCurveId
);
id_type!(
PointId
);
id_type!(
UnknownId
);
id_type!(
AppearanceId
);
id_type!(
AttributeId
);