Names of every registered table.
()
| 192 | |
| 193 | /// Names of every registered table. |
| 194 | pub(crate) fn table_names() -> Vec<String> { |
| 195 | struct Names(Vec<String>); |
| 196 | |
| 197 | impl TableVisitor for Names { |
| 198 | fn table<K: Key + 'static, V: Value + 'static>( |
| 199 | &mut self, |
| 200 | definition: TableDefinition<'static, K, V>, |
| 201 | ) -> PristineResult<()> { |
| 202 | self.0.push(definition.name().to_string()); |
| 203 | Ok(()) |
| 204 | } |
| 205 | |
| 206 | fn multimap<K: Key + 'static, V: Key + 'static>( |
| 207 | &mut self, |
| 208 | definition: MultimapTableDefinition<'static, K, V>, |
| 209 | ) -> PristineResult<()> { |
| 210 | self.0.push(definition.name().to_string()); |
| 211 | Ok(()) |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | let mut names = Names(Vec::new()); |
| 216 | visit_tables(&mut names).expect("collecting table names cannot fail"); |
| 217 | names.0 |
| 218 | } |
| 219 | |
| 220 | /// Record the baseline schema unless the database already carries a version. |
| 221 | pub(crate) fn stamp_schema_version(txn: &WriteTransaction) -> PristineResult<()> { |