Skip to main content

dataprof_runtime/
memory_config.rs

1/// Shared engine configuration for memory limits.
2///
3/// Provides a consistent default across all engines that enforce memory bounds.
4#[derive(Debug, Clone)]
5pub struct MemoryConfig {
6    /// Maximum memory budget in megabytes.
7    pub limit_mb: usize,
8}
9
10impl MemoryConfig {
11    pub fn new(limit_mb: usize) -> Self {
12        Self { limit_mb }
13    }
14}
15
16impl Default for MemoryConfig {
17    fn default() -> Self {
18        Self { limit_mb: 256 }
19    }
20}
21
22#[cfg(test)]
23mod tests {
24    use super::MemoryConfig;
25
26    #[test]
27    fn default_limit_matches_engine_expectation() {
28        assert_eq!(MemoryConfig::default().limit_mb, 256);
29    }
30
31    #[test]
32    fn new_sets_limit() {
33        assert_eq!(MemoryConfig::new(1024).limit_mb, 1024);
34    }
35}