Skip to main content

factorio_ir/
function.rs

1use crate::{block::Block, debug::FunctionDebug, r#type::Type};
2
3#[derive(Debug, Clone, PartialEq, Eq)]
4pub struct Parameter {
5    pub name: String,
6    pub r#type: Type,
7    pub source_type: Option<String>,
8}
9
10#[derive(Debug, Clone, PartialEq)]
11pub struct Function {
12    pub name: String,
13    pub params: Vec<Parameter>,
14    pub body: Block,
15    pub doc: Option<String>,
16    pub debug: Option<FunctionDebug>,
17    /// Factorio event name when this function is registered with `#[factorio_rs::event(...)]`.
18    pub event: Option<String>,
19    /// Optional event filter table passed to `script.on_event`.
20    pub event_filter: Option<crate::expression::Expression>,
21}