lumen_engine/node/
ports.rs1use super::ids::NodeId;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4pub struct InputPortDef {
5 pub name: &'static str,
6 pub kind: PortKind,
7 pub optional: bool,
8 pub variadic: bool,
9}
10
11#[derive(Debug, Clone, Copy, PartialEq, Eq)]
12pub struct OutputPortDef {
13 pub name: &'static str,
14 pub kind: PortKind,
15}
16
17#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
18#[repr(u8)]
19pub enum PortKind {
20 Raster = 0,
21 Vector = 1,
22}
23
24#[derive(Debug, Clone, PartialEq, Eq, Hash)]
25pub struct PortRef {
26 pub id: NodeId,
27 pub port: String,
28}
29
30impl PortRef {
31 pub fn new(id: NodeId, port: String) -> Self {
32 Self { id, port }
33 }
34
35 pub fn empty() -> Self {
36 Self {
37 id: NodeId::new(0),
38 port: String::new(),
39 }
40 }
41
42 pub fn is_empty(&self) -> bool {
43 self.id.0 == 0
44 }
45}
46
47pub const SINGLE_RASTER_OUTPUT: &[OutputPortDef] = &[OutputPortDef {
48 name: "output",
49 kind: PortKind::Raster,
50}];