mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 20:31:13 +00:00
Adds with_pair! macro to application-crypto (#4885)
* Adds `with_pair!` macro to application-crypto This macro will "generate" the given code only when the crypto pair is available. So, when either the `std` or the `full_crypto` feature is enabled. * Fix example
This commit is contained in:
@@ -436,3 +436,30 @@ macro_rules! wrap {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Generate the given code if the pair type is available.
|
||||
///
|
||||
/// The pair type is available when `feature = "std"` || `feature = "full_crypto"`.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// sp_application_crypto::with_pair! {
|
||||
/// pub type Pair = ();
|
||||
/// }
|
||||
/// ```
|
||||
#[macro_export]
|
||||
#[cfg(any(feature = "std", feature = "full_crypto"))]
|
||||
macro_rules! with_pair {
|
||||
( $( $def:tt )* ) => {
|
||||
$( $def )*
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[doc(hidden)]
|
||||
#[macro_export]
|
||||
#[cfg(all(not(feature = "std"), not(feature = "full_crypto")))]
|
||||
macro_rules! with_pair {
|
||||
( $( $def:tt )* ) => {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user