sim_incremental_core/
budget.rs1#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5pub enum BudgetKind {
6 Work,
8 Observations,
10 Depth,
12 Output,
14}
15
16#[derive(Clone, Copy, Debug, Eq, PartialEq)]
18pub struct QueryBudgets {
19 pub max_work: usize,
21 pub max_observations: usize,
23 pub max_depth: usize,
25 pub max_output: usize,
27 pub max_explanation_causes: usize,
29}
30
31impl QueryBudgets {
32 #[must_use]
34 pub const fn unlimited() -> Self {
35 Self {
36 max_work: usize::MAX,
37 max_observations: usize::MAX,
38 max_depth: usize::MAX,
39 max_output: usize::MAX,
40 max_explanation_causes: usize::MAX,
41 }
42 }
43
44 #[must_use]
46 pub const fn new(
47 max_work: usize,
48 max_observations: usize,
49 max_depth: usize,
50 max_output: usize,
51 ) -> Self {
52 Self {
53 max_work,
54 max_observations,
55 max_depth,
56 max_output,
57 max_explanation_causes: usize::MAX,
58 }
59 }
60
61 #[must_use]
63 pub const fn with_explanation_causes(mut self, max_explanation_causes: usize) -> Self {
64 self.max_explanation_causes = max_explanation_causes;
65 self
66 }
67}
68
69impl Default for QueryBudgets {
70 fn default() -> Self {
71 Self::unlimited()
72 }
73}
74
75#[derive(Clone, Copy, Debug, Eq, PartialEq)]
77pub struct SnapshotBudgets {
78 pub max_nodes: usize,
80 pub max_edges: usize,
82}
83
84impl SnapshotBudgets {
85 #[must_use]
87 pub const fn unlimited() -> Self {
88 Self {
89 max_nodes: usize::MAX,
90 max_edges: usize::MAX,
91 }
92 }
93
94 #[must_use]
96 pub const fn new(max_nodes: usize, max_edges: usize) -> Self {
97 Self {
98 max_nodes,
99 max_edges,
100 }
101 }
102}
103
104impl Default for SnapshotBudgets {
105 fn default() -> Self {
106 Self::unlimited()
107 }
108}