From 481d66b691e9e38c2cb5dc4a535f7039bea6f67c Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Mon, 15 Nov 2021 12:39:41 +0100 Subject: [PATCH] Refactor indexes into its own module --- .../storage-plus/src/{indexes.rs => indexes/mod.rs} | 5 +++++ .../src/{multi_index.rs => indexes/multi.rs} | 0 .../src/{unique_index.rs => indexes/unique.rs} | 0 packages/storage-plus/src/lib.rs | 10 ++++------ 4 files changed, 9 insertions(+), 6 deletions(-) rename packages/storage-plus/src/{indexes.rs => indexes/mod.rs} (92%) rename packages/storage-plus/src/{multi_index.rs => indexes/multi.rs} (100%) rename packages/storage-plus/src/{unique_index.rs => indexes/unique.rs} (100%) diff --git a/packages/storage-plus/src/indexes.rs b/packages/storage-plus/src/indexes/mod.rs similarity index 92% rename from packages/storage-plus/src/indexes.rs rename to packages/storage-plus/src/indexes/mod.rs index ce7698187..23c9e9d24 100644 --- a/packages/storage-plus/src/indexes.rs +++ b/packages/storage-plus/src/indexes/mod.rs @@ -1,5 +1,10 @@ // this module requires iterator to be useful at all #![cfg(feature = "iterator")] +mod multi; +mod unique; + +pub use multi::MultiIndex; +pub use unique::UniqueIndex; use serde::de::DeserializeOwned; use serde::Serialize; diff --git a/packages/storage-plus/src/multi_index.rs b/packages/storage-plus/src/indexes/multi.rs similarity index 100% rename from packages/storage-plus/src/multi_index.rs rename to packages/storage-plus/src/indexes/multi.rs diff --git a/packages/storage-plus/src/unique_index.rs b/packages/storage-plus/src/indexes/unique.rs similarity index 100% rename from packages/storage-plus/src/unique_index.rs rename to packages/storage-plus/src/indexes/unique.rs diff --git a/packages/storage-plus/src/lib.rs b/packages/storage-plus/src/lib.rs index fabd69b6c..53bbba036 100644 --- a/packages/storage-plus/src/lib.rs +++ b/packages/storage-plus/src/lib.rs @@ -8,11 +8,9 @@ mod item; mod iter_helpers; mod keys; mod map; -mod multi_index; mod path; mod prefix; mod snapshot; -mod unique_index; pub use endian::Endian; #[cfg(feature = "iterator")] @@ -20,17 +18,17 @@ pub use indexed_map::{IndexList, IndexedMap}; #[cfg(feature = "iterator")] pub use indexed_snapshot::IndexedSnapshotMap; #[cfg(feature = "iterator")] +pub use indexes::MultiIndex; +#[cfg(feature = "iterator")] +pub use indexes::UniqueIndex; +#[cfg(feature = "iterator")] pub use indexes::{index_string, index_string_tuple, index_triple, index_tuple, Index}; pub use item::Item; pub use keys::{I128Key, I16Key, I32Key, I64Key, I8Key}; pub use keys::{Prefixer, PrimaryKey, U128Key, U16Key, U32Key, U64Key, U8Key}; pub use map::Map; -#[cfg(feature = "iterator")] -pub use multi_index::MultiIndex; pub use path::Path; #[cfg(feature = "iterator")] pub use prefix::{range_with_prefix, Bound, Prefix}; #[cfg(feature = "iterator")] pub use snapshot::{SnapshotItem, SnapshotMap, Strategy}; -#[cfg(feature = "iterator")] -pub use unique_index::UniqueIndex;