From cf5c8567235eadde39c1448edc69a6e252d2b151 Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Thu, 14 Sep 2023 18:19:12 -0400 Subject: [PATCH] Remove metered map iterator functions. (#1068) These aren't used/needed anymore. --- soroban-env-host/src/host/metered_map.rs | 50 ------------------------ 1 file changed, 50 deletions(-) diff --git a/soroban-env-host/src/host/metered_map.rs b/soroban-env-host/src/host/metered_map.rs index b819b15ed..dd8050c9f 100644 --- a/soroban-env-host/src/host/metered_map.rs +++ b/soroban-env-host/src/host/metered_map.rs @@ -260,56 +260,6 @@ where Ok(self.find(key, ctx)?.is_ok()) } - pub fn get_prev(&self, key: &Q, ctx: &Ctx) -> Result, HostError> - where - K: Borrow, - Ctx: Compare, - { - match self.find(key, ctx)? { - Ok(hit) if hit == 0 => Ok(None), - Ok(hit) => Ok(Some(&self.map[hit - 1])), - // Err(miss) means you could insert key at miss - // to maintain sort order (meaning that the element - // currently at miss, if it exists, is > than key). - Err(miss) if miss == 0 => Ok(None), - Err(miss) if miss - 1 < self.map.len() => Ok(Some(&self.map[miss - 1])), - Err(_) => Ok(None), - } - } - - pub fn get_next(&self, key: &Q, ctx: &Ctx) -> Result, HostError> - where - K: Borrow, - Ctx: Compare, - { - match self.find(key, ctx)? { - Ok(hit) if (hit < usize::MAX) && (hit + 1 < self.map.len()) => { - Ok(Some(&self.map[hit + 1])) - } - Ok(hit) => Ok(None), - Err(miss) if (miss < self.map.len()) => Ok(Some(&self.map[miss])), - Err(miss) => Ok(None), - } - } - - pub fn get_min(&self, ctx: &Ctx) -> Result, HostError> - where - K: Borrow, - Ctx: Compare, - { - self.charge_access(1, ctx)?; - Ok(self.map.as_slice().first()) - } - - pub fn get_max(&self, ctx: &Ctx) -> Result, HostError> - where - K: Borrow, - Ctx: Compare, - { - self.charge_access(1, ctx)?; - Ok(self.map.as_slice().last()) - } - pub fn keys(&self, ctx: &Ctx) -> Result, HostError> { self.charge_scan(ctx)?; Ok(self.map.iter().map(|(k, _)| k))