async_flow/io/
port_direction.rs1#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
6#[cfg_attr(feature = "serde", serde(rename_all = "lowercase"))]
7pub enum PortDirection {
8 Input,
9 Output,
10}
11
12impl PortDirection {
13 pub fn is_input(&self) -> bool {
15 *self == Self::Input
16 }
17
18 pub fn is_output(&self) -> bool {
20 *self == Self::Output
21 }
22
23 pub fn as_str(&self) -> &str {
24 match self {
25 Self::Input => "input",
26 Self::Output => "output",
27 }
28 }
29}
30
31impl AsRef<str> for PortDirection {
32 fn as_ref(&self) -> &str {
33 self.as_str()
34 }
35}