#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "lowercase"))]
pub enum PortDirection {
Input,
Output,
}
impl PortDirection {
pub fn is_input(&self) -> bool {
*self == Self::Input
}
pub fn is_output(&self) -> bool {
*self == Self::Output
}
pub fn as_str(&self) -> &str {
match self {
Self::Input => "input",
Self::Output => "output",
}
}
}
impl AsRef<str> for PortDirection {
fn as_ref(&self) -> &str {
self.as_str()
}
}