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:
Bastian Köcher
2023-11-23 14:52:46 +01:00
committed by GitHub
parent 12062f6a3a
commit 21f1811c66
30 changed files with 124 additions and 99 deletions
@@ -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 {