mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 08:51:09 +00:00
sp-api: Move macro related re-exports to __private (#2446)
This moves the macro related re-exports to `__private` to make it more obvious for downstream users that they are using an internal api. --------- Co-authored-by: command-bot <>
This commit is contained in:
@@ -15,17 +15,17 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false }
|
||||
sp-api-proc-macro = { path = "proc-macro" }
|
||||
sp-core = { path = "../core", default-features = false}
|
||||
sp-std = { path = "../std", default-features = false}
|
||||
sp-runtime = { path = "../runtime", default-features = false}
|
||||
sp-externalities = { path = "../externalities", default-features = false, optional = true}
|
||||
sp-version = { path = "../version", default-features = false}
|
||||
sp-state-machine = { path = "../state-machine", default-features = false, optional = true}
|
||||
sp-trie = { path = "../trie", default-features = false, optional = true}
|
||||
sp-core = { path = "../core", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
sp-runtime = { path = "../runtime", default-features = false }
|
||||
sp-externalities = { path = "../externalities", default-features = false, optional = true }
|
||||
sp-version = { path = "../version", default-features = false }
|
||||
sp-state-machine = { path = "../state-machine", default-features = false, optional = true }
|
||||
sp-trie = { path = "../trie", default-features = false, optional = true }
|
||||
hash-db = { version = "0.16.0", optional = true }
|
||||
thiserror = { version = "1.0.48", optional = true }
|
||||
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
|
||||
sp-metadata-ir = { path = "../metadata-ir", default-features = false, optional = true}
|
||||
sp-metadata-ir = { path = "../metadata-ir", default-features = false, optional = true }
|
||||
log = { version = "0.4.17", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -28,14 +28,14 @@ use syn::{
|
||||
/// Generates the access to the `sc_client` crate.
|
||||
pub fn generate_crate_access() -> TokenStream {
|
||||
match crate_name("sp-api") {
|
||||
Ok(FoundCrate::Itself) => quote!(sp_api),
|
||||
Ok(FoundCrate::Itself) => quote!(sp_api::__private),
|
||||
Ok(FoundCrate::Name(renamed_name)) => {
|
||||
let renamed_name = Ident::new(&renamed_name, Span::call_site());
|
||||
quote!(#renamed_name)
|
||||
quote!(#renamed_name::__private)
|
||||
},
|
||||
Err(e) =>
|
||||
if let Ok(FoundCrate::Name(name)) = crate_name(&"frame") {
|
||||
let path = format!("{}::deps::{}", name, "sp_api");
|
||||
let path = format!("{}::deps::sp_api::__private", name);
|
||||
let path = syn::parse_str::<syn::Path>(&path).expect("is a valid path; qed");
|
||||
quote!( #path )
|
||||
} else {
|
||||
|
||||
@@ -70,48 +70,58 @@
|
||||
// Make doc tests happy
|
||||
extern crate self as sp_api;
|
||||
|
||||
/// Private exports used by the macros.
|
||||
///
|
||||
/// This is seen as internal API and can change at any point.
|
||||
#[doc(hidden)]
|
||||
pub use codec::{self, Decode, DecodeLimit, Encode};
|
||||
#[doc(hidden)]
|
||||
#[cfg(feature = "std")]
|
||||
pub use hash_db::Hasher;
|
||||
#[doc(hidden)]
|
||||
pub use scale_info;
|
||||
#[doc(hidden)]
|
||||
pub use sp_core::offchain;
|
||||
#[doc(hidden)]
|
||||
#[cfg(not(feature = "std"))]
|
||||
pub use sp_core::to_substrate_wasm_fn_return_value;
|
||||
#[doc(hidden)]
|
||||
pub mod __private {
|
||||
#[cfg(feature = "std")]
|
||||
mod std_imports {
|
||||
pub use hash_db::Hasher;
|
||||
pub use sp_core::traits::CallContext;
|
||||
pub use sp_externalities::{Extension, Extensions};
|
||||
pub use sp_runtime::StateVersion;
|
||||
pub use sp_state_machine::{
|
||||
Backend as StateBackend, InMemoryBackend, OverlayedChanges, StorageProof, TrieBackend,
|
||||
TrieBackendBuilder,
|
||||
};
|
||||
}
|
||||
#[cfg(feature = "std")]
|
||||
pub use std_imports::*;
|
||||
|
||||
pub use crate::*;
|
||||
pub use codec::{self, Decode, DecodeLimit, Encode};
|
||||
pub use scale_info;
|
||||
pub use sp_core::offchain;
|
||||
#[cfg(not(feature = "std"))]
|
||||
pub use sp_core::to_substrate_wasm_fn_return_value;
|
||||
#[cfg(feature = "frame-metadata")]
|
||||
pub use sp_metadata_ir::{self as metadata_ir, frame_metadata as metadata};
|
||||
pub use sp_runtime::{
|
||||
generic::BlockId,
|
||||
traits::{Block as BlockT, Hash as HashT, HashingFor, Header as HeaderT, NumberFor},
|
||||
transaction_validity::TransactionValidity,
|
||||
RuntimeString, TransactionOutcome,
|
||||
};
|
||||
pub use sp_std::{mem, slice, vec};
|
||||
pub use sp_version::{create_apis_vec, ApiId, ApisVec, RuntimeVersion};
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub use sp_core::traits::CallContext;
|
||||
use sp_core::OpaqueMetadata;
|
||||
#[doc(hidden)]
|
||||
#[cfg(feature = "std")]
|
||||
pub use sp_externalities::{Extension, Extensions};
|
||||
#[doc(hidden)]
|
||||
#[cfg(feature = "frame-metadata")]
|
||||
pub use sp_metadata_ir::{self as metadata_ir, frame_metadata as metadata};
|
||||
#[doc(hidden)]
|
||||
use sp_externalities::{Extension, Extensions};
|
||||
use sp_runtime::traits::Block as BlockT;
|
||||
#[cfg(feature = "std")]
|
||||
pub use sp_runtime::StateVersion;
|
||||
#[doc(hidden)]
|
||||
pub use sp_runtime::{
|
||||
generic::BlockId,
|
||||
traits::{Block as BlockT, Hash as HashT, HashingFor, Header as HeaderT, NumberFor},
|
||||
transaction_validity::TransactionValidity,
|
||||
RuntimeString, TransactionOutcome,
|
||||
};
|
||||
#[doc(hidden)]
|
||||
use sp_runtime::traits::HashingFor;
|
||||
#[cfg(feature = "std")]
|
||||
pub use sp_state_machine::{
|
||||
backend::AsTrieBackend, Backend as StateBackend, InMemoryBackend, OverlayedChanges,
|
||||
StorageProof, TrieBackend, TrieBackendBuilder,
|
||||
};
|
||||
#[doc(hidden)]
|
||||
pub use sp_std::{mem, slice, vec};
|
||||
#[doc(hidden)]
|
||||
pub use sp_version::{create_apis_vec, ApiId, ApisVec, RuntimeVersion};
|
||||
pub use sp_runtime::TransactionOutcome;
|
||||
#[cfg(feature = "std")]
|
||||
pub use sp_state_machine::StorageProof;
|
||||
#[cfg(feature = "std")]
|
||||
use sp_state_machine::{backend::AsTrieBackend, Backend as StateBackend, OverlayedChanges};
|
||||
use sp_version::RuntimeVersion;
|
||||
#[cfg(feature = "std")]
|
||||
use std::cell::RefCell;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user