use crate::state::workflow_state::WorkflowState;
pub struct CompilerContext<S: WorkflowState> {
pub max_inline_size: usize,
pub debug: bool,
pub stats: CompilerStats,
_phantom: std::marker::PhantomData<S>,
}
impl<S: WorkflowState> CompilerContext<S> {
pub fn new() -> Self {
Self {
max_inline_size: 100, debug: false,
stats: CompilerStats::default(),
_phantom: std::marker::PhantomData,
}
}
pub fn max_inline_size(mut self, max: usize) -> Self {
self.max_inline_size = max;
self
}
pub fn debug(mut self, enable: bool) -> Self {
self.debug = enable;
self
}
}
impl<S: WorkflowState> Default for CompilerContext<S> {
fn default() -> Self {
Self::new()
}
}
#[derive(Debug, Default, Clone)]
pub struct CompilerStats {
pub subgraph_count: usize,
pub inlined_count: usize,
pub not_inlined_count: usize,
pub total_nodes_before: usize,
pub total_nodes_after: usize,
}