pumpkin-core 0.5.0

The core of the Pumpkin constraint programming solver.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::containers::StorageKey;

/// An integer whose value is automatically restored upon backtracking to its previous value at the
/// checkpoint to which backtracking occurred.
#[derive(Debug, Clone, Copy)]
pub struct TrailedInteger {
    id: u32,
}

impl StorageKey for TrailedInteger {
    fn index(&self) -> usize {
        self.id as usize
    }

    fn create_from_index(index: usize) -> Self {
        Self { id: index as u32 }
    }
}