Skip to content

Commit 7f63657

Browse files
committed
Group imports and exports in exports module
1 parent af40836 commit 7f63657

File tree

6 files changed

+26
-16
lines changed

6 files changed

+26
-16
lines changed

packages/std/src/exports.rs renamed to packages/std/src/exports/exports.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ use core::{marker::PhantomData, ptr};
1212

1313
use serde::de::DeserializeOwned;
1414

15+
use super::imports::{ExternalApi, ExternalQuerier, ExternalStorage};
16+
use super::memory::{Owned, Region};
17+
use super::panic::install_panic_handler;
1518
use crate::deps::OwnedDeps;
1619
#[cfg(any(feature = "stargate", feature = "ibc2"))]
1720
use crate::ibc::IbcReceiveResponse;
@@ -24,9 +27,6 @@ use crate::ibc::{
2427
use crate::ibc::{IbcChannelOpenMsg, IbcChannelOpenResponse};
2528
#[cfg(feature = "ibc2")]
2629
use crate::ibc2::{Ibc2PacketReceiveMsg, Ibc2PacketTimeoutMsg};
27-
use crate::imports::{ExternalApi, ExternalQuerier, ExternalStorage};
28-
use crate::memory::{Owned, Region};
29-
use crate::panic::install_panic_handler;
3030
use crate::query::CustomQuery;
3131
use crate::results::{ContractResult, QueryResponse, Reply, Response};
3232
use crate::serde::{from_json, to_json_vec};

packages/std/src/imports.rs renamed to packages/std/src/exports/imports.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
use alloc::vec::Vec;
22
use core::ptr;
33

4+
#[cfg(feature = "iterator")]
5+
use super::memory::get_optional_region_address;
6+
use super::memory::{Owned, Region};
47
use crate::import_helpers::{from_high_half, from_low_half};
5-
use crate::memory::{Owned, Region};
8+
#[cfg(feature = "iterator")]
9+
use crate::iterator::{Order, Record};
610
use crate::results::SystemResult;
711
#[cfg(feature = "iterator")]
812
use crate::sections::decode_sections2;
913
use crate::sections::encode_sections;
1014
use crate::serde::from_json;
1115
use crate::traits::{Api, Querier, QuerierResult, Storage};
12-
#[cfg(feature = "iterator")]
13-
use crate::{
14-
iterator::{Order, Record},
15-
memory::get_optional_region_address,
16-
};
1716
use crate::{Addr, CanonicalAddr};
1817
#[cfg(feature = "cosmwasm_2_1")]
1918
use crate::{AggregationError, HashFunction, PairingEqualityError};
File renamed without changes.

packages/std/src/exports/mod.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
mod exports;
2+
mod imports;
3+
mod memory; // Used by exports and imports only. This assumes pointers are 32 bit long, which makes it untestable on dev machines.
4+
mod panic;
5+
6+
#[cfg(feature = "cosmwasm_2_2")]
7+
pub use exports::do_migrate_with_info;
8+
pub use exports::{
9+
do_execute, do_ibc_destination_callback, do_ibc_source_callback, do_instantiate, do_migrate,
10+
do_query, do_reply, do_sudo,
11+
};
12+
#[cfg(feature = "ibc2")]
13+
pub use exports::{do_ibc2_packet_receive, do_ibc2_packet_timeout};
14+
#[cfg(feature = "stargate")]
15+
pub use exports::{
16+
do_ibc_channel_close, do_ibc_channel_connect, do_ibc_channel_open, do_ibc_packet_ack,
17+
do_ibc_packet_receive, do_ibc_packet_timeout,
18+
};

packages/std/src/panic.rs renamed to packages/std/src/exports/panic.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
///
44
/// This overrides any previous panic handler. See <https://doc.rust-lang.org/std/panic/fn.set_hook.html>
55
/// for details.
6-
#[cfg(target_arch = "wasm32")]
76
pub fn install_panic_handler() {
87
use super::imports::handle_panic;
98
std::panic::set_hook(Box::new(|info| {

packages/std/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ mod metadata;
3333
mod msgpack;
3434
mod never;
3535
mod pagination;
36-
mod panic;
3736
mod query;
3837
mod results;
3938
mod sections;
@@ -115,13 +114,8 @@ pub use crate::timestamp::Timestamp;
115114
pub use crate::traits::{Api, HashFunction, Querier, QuerierResult, QuerierWrapper, Storage};
116115
pub use crate::types::{BlockInfo, ContractInfo, Env, MessageInfo, MigrateInfo, TransactionInfo};
117116

118-
// Exposed in wasm build only
119117
#[cfg(target_arch = "wasm32")]
120118
mod exports;
121-
#[cfg(target_arch = "wasm32")]
122-
mod imports;
123-
#[cfg(target_arch = "wasm32")]
124-
mod memory; // Used by exports and imports only. This assumes pointers are 32 bit long, which makes it untestable on dev machines.
125119

126120
#[cfg(all(feature = "cosmwasm_2_2", target_arch = "wasm32"))]
127121
pub use crate::exports::do_migrate_with_info;

0 commit comments

Comments
 (0)