Restore group states from a persisted snapshot.
(&self, snapshot: Vec<(String, Vec<GroupState>)>)
| 210 | |
| 211 | /// Restore group states from a persisted snapshot. |
| 212 | pub fn restore(&self, snapshot: Vec<(String, Vec<GroupState>)>) { |
| 213 | let mut groups = self.groups.write().unwrap_or_else(|p| p.into_inner()); |
| 214 | groups.clear(); |
| 215 | for (key, states) in snapshot { |
| 216 | groups.insert(key, states); |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | /// Estimated memory usage in bytes. |
| 221 | pub fn estimated_memory(&self) -> usize { |