Skip to content

Commit

Permalink
hide internal macros from public interface (#755)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsdw authored May 6, 2022
1 parent 7690a26 commit ad429c7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
#![warn(missing_docs, missing_debug_implementations, unreachable_pub)]

#[doc(hidden)]
// Macros useful internally within this crate, but not to be exposed outside of it.
#[macro_use]
pub mod macros;
mod macros;

/// Error type.
pub mod error;
Expand Down
7 changes: 3 additions & 4 deletions core/src/macros.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[macro_export]
macro_rules! cfg_feature {
($feature:literal, $($item:item)*) => {
$(
Expand All @@ -11,19 +10,19 @@ macro_rules! cfg_feature {

macro_rules! cfg_client {
($($item:item)*) => {
$crate::cfg_feature!("client", $($item)*);
cfg_feature!("client", $($item)*);
};
}

macro_rules! cfg_server {
($($item:item)*) => {
$crate::cfg_feature!("server", $($item)*);
cfg_feature!("server", $($item)*);
};
}

macro_rules! cfg_http_helpers {
($($item:item)*) => {
$crate::cfg_feature!("http-helpers", $($item)*);
cfg_feature!("http-helpers", $($item)*);
};
}

Expand Down
1 change: 1 addition & 0 deletions jsonrpsee/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
//! - **`client-ws-transport`** - Enables `ws` transport with TLS.
//! - **`client-ws-transport-no-tls`** - Enables `ws` transport without TLS.
// Macros useful below, but not to be exposed outside of the crate.
#[macro_use]
mod macros;

Expand Down
17 changes: 8 additions & 9 deletions jsonrpsee/src/macros.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[macro_export]
macro_rules! cfg_feature {
($feature:literal, $($item:item)*) => {
$(
Expand All @@ -20,31 +19,31 @@ macro_rules! cfg_client {

macro_rules! cfg_http_client {
($($item:item)*) => {
$crate::cfg_feature!("jsonrpsee-http-client", $($item)*);
cfg_feature!("jsonrpsee-http-client", $($item)*);
};
}

macro_rules! cfg_ws_client {
($($item:item)*) => {
$crate::cfg_feature!("jsonrpsee-ws-client", $($item)*);
cfg_feature!("jsonrpsee-ws-client", $($item)*);
};
}

macro_rules! cfg_wasm_client {
($($item:item)*) => {
$crate::cfg_feature!("jsonrpsee-wasm-client", $($item)*);
cfg_feature!("jsonrpsee-wasm-client", $($item)*);
};
}

macro_rules! cfg_async_client {
($($item:item)*) => {
$crate::cfg_feature!("async-client", $($item)*);
cfg_feature!("async-client", $($item)*);
};
}

macro_rules! cfg_client_transport {
($($item:item)*) => {
$crate::cfg_feature!("jsonrpsee-client-transport", $($item)*);
cfg_feature!("jsonrpsee-client-transport", $($item)*);
};
}

Expand All @@ -69,19 +68,19 @@ macro_rules! cfg_http_server {

macro_rules! cfg_ws_server {
($($item:item)*) => {
$crate::cfg_feature!("jsonrpsee-ws-server", $($item)*);
cfg_feature!("jsonrpsee-ws-server", $($item)*);
};
}

macro_rules! cfg_proc_macros {
($($item:item)*) => {
$crate::cfg_feature!("jsonrpsee-proc-macros", $($item)*);
cfg_feature!("jsonrpsee-proc-macros", $($item)*);
};
}

macro_rules! cfg_types {
($($item:item)*) => {
$crate::cfg_feature!("jsonrpsee-types", $($item)*);
cfg_feature!("jsonrpsee-types", $($item)*);
};
}

Expand Down

0 comments on commit ad429c7

Please sign in to comment.