@@ -50,26 +50,25 @@ macro_rules! impl_mechanisms {
5050#[ cfg( feature = "crypto-client" ) ]
5151macro_rules! impl_rpc_method {
5252 {
53- $name: ident,
53+ $struct: ident,
54+ $method: ident,
5455 mechanisms = [ $(
5556 #[ cfg( $( $cfg_cond: tt) * ) ]
5657 $mechanism: ident,
5758 ) * ] ,
5859 } => {
59- paste:: paste! {
60- #[ inline( never) ]
61- fn $name(
62- & self ,
63- keystore: & mut impl Keystore ,
64- request: & request:: [ <$name: camel>] ,
65- ) -> Result <reply:: [ <$name: camel>] > {
66- match self {
67- $(
68- #[ cfg( $( $cfg_cond) * ) ]
69- Self :: $mechanism => mechanisms:: $mechanism. $name( keystore, request) ,
70- ) *
71- _ => Err ( Error :: MechanismNotAvailable ) ,
72- }
60+ #[ inline( never) ]
61+ fn $method(
62+ & self ,
63+ keystore: & mut impl Keystore ,
64+ request: & request:: $struct,
65+ ) -> Result <reply:: $struct> {
66+ match self {
67+ $(
68+ #[ cfg( $( $cfg_cond) * ) ]
69+ Self :: $mechanism => mechanisms:: $mechanism. $method( keystore, request) ,
70+ ) *
71+ _ => Err ( Error :: MechanismNotAvailable ) ,
7372 }
7473 }
7574 }
@@ -78,28 +77,27 @@ macro_rules! impl_rpc_method {
7877#[ cfg( feature = "crypto-client" ) ]
7978macro_rules! rpc_trait {
8079 {
81- methods = [ $( $name : ident, ) * ] ,
80+ methods = [ $( $method : ident : $struct : ident, ) * ] ,
8281 mechanisms = $mechanisms: tt,
8382 } => {
8483 pub trait MechanismImpl {
8584 $(
86- paste:: paste! {
87- fn $name(
88- & self ,
89- keystore: & mut impl Keystore ,
90- request: & request:: [ <$name: camel>] ,
91- ) -> Result <reply:: [ <$name: camel>] > {
92- let _ = ( keystore, request) ;
93- Err ( Error :: MechanismNotAvailable )
94- }
85+ fn $method(
86+ & self ,
87+ keystore: & mut impl Keystore ,
88+ request: & request:: $struct,
89+ ) -> Result <reply:: $struct> {
90+ let _ = ( keystore, request) ;
91+ Err ( Error :: MechanismNotAvailable )
9592 }
9693 ) *
9794 }
9895
9996 impl MechanismImpl for Mechanism {
10097 $(
10198 impl_rpc_method! {
102- $name,
99+ $struct,
100+ $method,
103101 mechanisms = $mechanisms,
104102 }
105103 ) *
@@ -114,21 +112,21 @@ macro_rules! rpc_trait {
114112#[ cfg( feature = "crypto-client" ) ]
115113rpc_trait ! {
116114 methods = [
117- agree,
118- decrypt,
119- derive_key,
120- deserialize_key,
121- encrypt,
122- exists,
123- generate_key,
124- hash,
125- serialize_key,
126- sign,
127- unsafe_inject_key,
128- unwrap_key,
129- verify,
115+ agree: Agree ,
116+ decrypt: Decrypt ,
117+ derive_key: DeriveKey ,
118+ deserialize_key: DeserializeKey ,
119+ encrypt: Encrypt ,
120+ exists: Exists ,
121+ generate_key: GenerateKey ,
122+ hash: Hash ,
123+ serialize_key: SerializeKey ,
124+ sign: Sign ,
125+ unsafe_inject_key: UnsafeInjectKey ,
126+ unwrap_key: UnwrapKey ,
127+ verify: Verify ,
130128 // TODO: can the default implementation be implemented in terms of Encrypt?
131- wrap_key,
129+ wrap_key: WrapKey ,
132130 ] ,
133131 mechanisms = [
134132 #[ cfg( feature = "aes256-cbc" ) ]
0 commit comments