diff --git a/soroban-sdk/src/address.rs b/soroban-sdk/src/address.rs index 07413f3f..48b92d3c 100644 --- a/soroban-sdk/src/address.rs +++ b/soroban-sdk/src/address.rs @@ -312,7 +312,7 @@ impl Address { } } -#[cfg(any(not(target_family = "wasm"), test, feature = "testutils"))] +#[cfg(any(test, feature = "testutils"))] use crate::env::xdr::Hash; use crate::unwrap::UnwrapOptimized; @@ -327,19 +327,3 @@ impl crate::testutils::Address for Address { .unwrap() } } - -#[cfg(not(target_family = "wasm"))] -impl Address { - pub(crate) fn contract_id(&self) -> Hash { - let sc_address: ScAddress = self.into(); - if let ScAddress::Contract(c) = sc_address { - c - } else { - panic!("address is not a contract {:?}", self); - } - } - - pub(crate) fn from_contract_id(env: &Env, contract_id: [u8; 32]) -> Self { - Self::try_from_val(env, &ScAddress::Contract(Hash(contract_id))).unwrap() - } -} diff --git a/soroban-sdk/src/bytes.rs b/soroban-sdk/src/bytes.rs index 37f1cb55..1b0f65b7 100644 --- a/soroban-sdk/src/bytes.rs +++ b/soroban-sdk/src/bytes.rs @@ -791,9 +791,13 @@ impl IntoIterator for Bytes { pub struct BytesIter(Bytes); impl BytesIter { - fn into_bin(self) -> Bytes { + pub fn into_bytes(self) -> Bytes { self.0 } + + pub fn to_bytes(&self) -> Bytes { + self.0.clone() + } } impl Iterator for BytesIter { diff --git a/soroban-sdk/src/events.rs b/soroban-sdk/src/events.rs index 6d6e9a98..5a6414b1 100644 --- a/soroban-sdk/src/events.rs +++ b/soroban-sdk/src/events.rs @@ -5,9 +5,6 @@ use core::fmt::Debug; use crate::{contracttype, Bytes, Map}; use crate::{env::internal, unwrap::UnwrapInfallible, Env, IntoVal, Val, Vec}; -// TODO: consolidate with host::events::TOPIC_BYTES_LENGTH_LIMIT -const TOPIC_BYTES_LENGTH_LIMIT: u32 = 32; - /// Events publishes events for the currently executing contract. /// /// ``` diff --git a/soroban-sdk/src/lib.rs b/soroban-sdk/src/lib.rs index 4bd940d5..8816756f 100644 --- a/soroban-sdk/src/lib.rs +++ b/soroban-sdk/src/lib.rs @@ -51,7 +51,6 @@ #![cfg_attr(target_family = "wasm", no_std)] #![cfg_attr(feature = "docs", feature(doc_cfg))] -#![allow(dead_code)] // The SDK uses #[test] in doctests, and does some sneaky line hiding to have // the doctest execute the test inside a main function instead. #![allow(clippy::test_attr_in_doctest)] diff --git a/soroban-sdk/src/map.rs b/soroban-sdk/src/map.rs index 2608ab4c..2905778e 100644 --- a/soroban-sdk/src/map.rs +++ b/soroban-sdk/src/map.rs @@ -291,11 +291,6 @@ impl Map { self.obj.to_val() } - #[inline(always)] - pub(crate) fn as_object(&self) -> &MapObject { - &self.obj - } - #[inline(always)] pub(crate) fn to_object(&self) -> MapObject { self.obj diff --git a/soroban-sdk/src/vec.rs b/soroban-sdk/src/vec.rs index 64d98d59..3d5e0e5f 100644 --- a/soroban-sdk/src/vec.rs +++ b/soroban-sdk/src/vec.rs @@ -953,7 +953,11 @@ impl VecTryIter { } } - fn into_vec(self) -> Vec { + pub fn into_vec(self) -> Vec { + self.to_vec() + } + + pub fn to_vec(&self) -> Vec { self.vec.slice(self.start..self.end) } }