diff options
| author | Sébastien Crozet <developer@crozet.re> | 2022-01-16 08:20:22 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-16 08:20:22 -0800 |
| commit | 1880619d29029c99985ffae9ed12a1c8d2cc796b (patch) | |
| tree | 806e7d950015875ebfcca5520784aea6e7c5ae10 /src/data | |
| parent | 4454a845e98b990abf3929ca46b59d0fca5a18ec (diff) | |
| parent | 0703e5527fd95d86bb6621e61dbcb1a6e7f9329a (diff) | |
| download | rapier-1880619d29029c99985ffae9ed12a1c8d2cc796b.tar.gz rapier-1880619d29029c99985ffae9ed12a1c8d2cc796b.tar.bz2 rapier-1880619d29029c99985ffae9ed12a1c8d2cc796b.zip | |
Merge pull request #277 from dimforge/solver-fixes
Fix some solver issues
Diffstat (limited to 'src/data')
| -rw-r--r-- | src/data/arena.rs | 7 | ||||
| -rw-r--r-- | src/data/coarena.rs | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/data/arena.rs b/src/data/arena.rs index c7cbf07..b14737e 100644 --- a/src/data/arena.rs +++ b/src/data/arena.rs @@ -70,11 +70,8 @@ impl Index { /// /// Providing arbitrary values will lead to malformed indices and ultimately /// panics. - pub fn from_raw_parts(a: u32, b: u32) -> Index { - Index { - index: a, - generation: b, - } + pub fn from_raw_parts(index: u32, generation: u32) -> Index { + Index { index, generation } } /// Convert this `Index` into its raw parts. diff --git a/src/data/coarena.rs b/src/data/coarena.rs index 1f01c05..c6fd122 100644 --- a/src/data/coarena.rs +++ b/src/data/coarena.rs @@ -29,6 +29,10 @@ impl<T> Coarena<T> { self.data.get(index as usize).map(|(_, t)| t) } + pub(crate) fn get_gen(&self, index: u32) -> Option<u32> { + self.data.get(index as usize).map(|(gen, _)| *gen) + } + /// Deletes an element for the coarena and returns its value. /// /// This method will reset the value to the given `removed_value`. |
