lellm_graph/compiler/
context.rs1use crate::state::workflow_state::WorkflowState;
4
5pub struct CompilerContext<S: WorkflowState> {
7 pub max_inline_size: usize,
9
10 pub debug: bool,
12
13 pub stats: CompilerStats,
15
16 _phantom: std::marker::PhantomData<S>,
18}
19
20impl<S: WorkflowState> CompilerContext<S> {
21 pub fn new() -> Self {
23 Self {
24 max_inline_size: 100, debug: false,
26 stats: CompilerStats::default(),
27 _phantom: std::marker::PhantomData,
28 }
29 }
30
31 pub fn max_inline_size(mut self, max: usize) -> Self {
33 self.max_inline_size = max;
34 self
35 }
36
37 pub fn debug(mut self, enable: bool) -> Self {
39 self.debug = enable;
40 self
41 }
42}
43
44impl<S: WorkflowState> Default for CompilerContext<S> {
45 fn default() -> Self {
46 Self::new()
47 }
48}
49
50#[derive(Debug, Default, Clone)]
52pub struct CompilerStats {
53 pub subgraph_count: usize,
55
56 pub inlined_count: usize,
58
59 pub not_inlined_count: usize,
61
62 pub total_nodes_before: usize,
64
65 pub total_nodes_after: usize,
67}