From 8ffe6a097cdbf9d1b4bc28b8a42273584d43eacc Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Fri, 2 May 2025 09:30:05 +0000 Subject: [PATCH 1/2] . --- src/btreeset.rs | 142 ++++++++++++++++++++++++++++-------------------- 1 file changed, 84 insertions(+), 58 deletions(-) diff --git a/src/btreeset.rs b/src/btreeset.rs index 69b32066..ed2f5055 100644 --- a/src/btreeset.rs +++ b/src/btreeset.rs @@ -65,9 +65,10 @@ where /// ## Basic Usage /// /// ```rust -/// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; +/// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// -/// let mut set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); +/// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); +/// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// /// set.insert(42); /// assert!(set.contains(&42)); @@ -78,9 +79,10 @@ where /// ## Range Queries /// /// ```rust -/// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; +/// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// -/// let mut set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); +/// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); +/// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// set.insert(1); /// set.insert(2); /// set.insert(3); @@ -94,7 +96,7 @@ where /// You can store custom types in a `BTreeSet` by implementing the `Storable` trait: /// /// ```rust -/// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl, Storable}; +/// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId, Storable}; /// use std::borrow::Cow; /// /// #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)] @@ -119,7 +121,8 @@ where /// }; /// } /// -/// let mut set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); +/// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); +/// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// set.insert(CustomType { id: 42 }); /// assert!(set.contains(&CustomType { id: 42 })); /// ``` @@ -171,9 +174,10 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let set: BTreeSet = BTreeSet::init(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let set: BTreeSet = BTreeSet::init(mem_mgr.get(MemoryId::new(0))); /// ``` pub fn init(memory: M) -> Self { BTreeSet { @@ -186,9 +190,10 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// ``` pub fn new(memory: M) -> Self { BTreeSet { @@ -201,9 +206,10 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// set.insert(42); /// /// // Save the set to memory @@ -228,9 +234,10 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// assert!(set.insert(42)); /// assert!(!set.insert(42)); // Key already exists /// ``` @@ -246,9 +253,10 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// set.insert(42); /// assert!(set.contains(&42)); /// assert!(!set.contains(&7)); @@ -265,9 +273,10 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// assert!(set.is_empty()); /// ``` pub fn is_empty(&self) -> bool { @@ -282,9 +291,10 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// set.insert(42); /// set.insert(7); /// assert_eq!(set.len(), 2); @@ -298,9 +308,10 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// let memory = set.into_memory(); /// ``` pub fn into_memory(self) -> M { @@ -317,9 +328,10 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// set.insert(42); /// set.clear(); /// assert!(set.is_empty()); @@ -337,9 +349,10 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// set.insert(42); /// set.insert(7); /// assert_eq!(set.first(), Some(7)); @@ -357,9 +370,10 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// set.insert(42); /// set.insert(7); /// assert_eq!(set.last(), Some(42)); @@ -376,9 +390,10 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// set.insert(42); /// assert!(set.remove(&42)); /// assert!(!set.contains(&42)); @@ -395,9 +410,10 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// set.insert(42); /// set.insert(7); /// assert_eq!(set.pop_last(), Some(42)); @@ -414,9 +430,10 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// set.insert(42); /// set.insert(7); /// assert_eq!(set.pop_first(), Some(7)); @@ -433,9 +450,10 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// set.insert(42); /// set.insert(7); /// for key in set.iter() { @@ -455,9 +473,10 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// set.insert(1); /// set.insert(2); /// set.insert(3); @@ -477,9 +496,10 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); /// set.insert(1); /// set.insert(2); /// set.insert(3); @@ -503,10 +523,11 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set1: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); - /// let mut set2: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set1: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); + /// let mut set2: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(1))); /// /// set1.insert(1); /// set1.insert(2); @@ -572,10 +593,11 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set1: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); - /// let mut set2: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set1: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); + /// let mut set2: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(1))); /// /// set1.insert(1); /// set1.insert(2); @@ -630,10 +652,11 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set1: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); - /// let mut set2: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set1: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); + /// let mut set2: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(1))); /// /// set1.insert(1); /// set1.insert(2); @@ -673,10 +696,11 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set1: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); - /// let mut set2: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set1: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); + /// let mut set2: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(1))); /// /// set1.insert(1); /// set1.insert(2); @@ -736,10 +760,11 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set1: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); - /// let mut set2: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set1: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); + /// let mut set2: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(1))); /// /// set1.insert(1); /// set1.insert(2); @@ -767,10 +792,11 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; /// - /// let mut set1: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); - /// let mut set2: BTreeSet = BTreeSet::new(DefaultMemoryImpl::default()); + /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); + /// let mut set1: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); + /// let mut set2: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(1))); /// /// set1.insert(1); /// set1.insert(2); From 0efd64f8d55ff57ead7ed24ed7b538e38101fdb7 Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Fri, 2 May 2025 09:42:42 +0000 Subject: [PATCH 2/2] . --- src/btreeset.rs | 78 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 52 insertions(+), 26 deletions(-) diff --git a/src/btreeset.rs b/src/btreeset.rs index ed2f5055..ebce52a3 100644 --- a/src/btreeset.rs +++ b/src/btreeset.rs @@ -65,7 +65,8 @@ where /// ## Basic Usage /// /// ```rust -/// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; +/// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; +/// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -79,7 +80,8 @@ where /// ## Range Queries /// /// ```rust -/// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; +/// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; +/// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -96,7 +98,8 @@ where /// You can store custom types in a `BTreeSet` by implementing the `Storable` trait: /// /// ```rust -/// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId, Storable}; +/// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl, Storable}; +/// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// use std::borrow::Cow; /// /// #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)] @@ -174,7 +177,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let set: BTreeSet = BTreeSet::init(mem_mgr.get(MemoryId::new(0))); @@ -190,7 +194,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -206,7 +211,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -234,7 +240,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -253,7 +260,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -273,7 +281,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -291,7 +300,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -308,7 +318,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -328,7 +339,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -349,7 +361,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -370,7 +383,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -390,7 +404,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -410,7 +425,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -430,7 +446,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -450,7 +467,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -473,7 +491,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -496,7 +515,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -523,7 +543,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set1: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -593,7 +614,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set1: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -652,7 +674,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set1: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -696,7 +719,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set1: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -760,7 +784,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set1: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0))); @@ -792,7 +817,8 @@ where /// # Example /// /// ```rust - /// use ic_stable_structures::{BTreeSet, MemoryManager, MemoryId}; + /// use ic_stable_structures::{BTreeSet, DefaultMemoryImpl}; + /// use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; /// /// let mem_mgr = MemoryManager::init(DefaultMemoryImpl::default()); /// let mut set1: BTreeSet = BTreeSet::new(mem_mgr.get(MemoryId::new(0)));