libsurfer/
variable_direction.rs

1use egui_remixicon::icons;
2use surfer_translation_types::VariableDirection;
3
4#[local_impl::local_impl]
5impl VariableDirectionExt for VariableDirection {
6    fn from_wellen_direction(direction: wellen::VarDirection) -> VariableDirection {
7        match direction {
8            wellen::VarDirection::Unknown => VariableDirection::Unknown,
9            wellen::VarDirection::Implicit => VariableDirection::Implicit,
10            wellen::VarDirection::Input => VariableDirection::Input,
11            wellen::VarDirection::Output => VariableDirection::Output,
12            wellen::VarDirection::InOut => VariableDirection::InOut,
13            wellen::VarDirection::Buffer => VariableDirection::Buffer,
14            wellen::VarDirection::Linkage => VariableDirection::Linkage,
15        }
16    }
17
18    fn get_icon(&self) -> Option<&str> {
19        match self {
20            VariableDirection::Unknown => None,
21            VariableDirection::Implicit => None,
22            VariableDirection::Input => Some(icons::CONTRACT_RIGHT_FILL),
23            VariableDirection::Output => Some(icons::EXPAND_RIGHT_FILL),
24            VariableDirection::InOut => Some(icons::ARROW_LEFT_RIGHT_LINE),
25            VariableDirection::Buffer => None,
26            VariableDirection::Linkage => Some(icons::LINK),
27        }
28    }
29}