Macro sp_runtime::impl_opaque_keys
source · macro_rules! impl_opaque_keys { { $( #[ $attr:meta ] )* pub struct $name:ident { $( $( #[ $inner_attr:meta ] )* pub $field:ident: $type:ty, )* } } => { ... }; }
Expand description
Implement OpaqueKeys
for a described struct.
Every field type must implement BoundToRuntimeAppPublic
.
KeyTypeIdProviders
is set to the types given as fields.
use sp_runtime::{
impl_opaque_keys, KeyTypeId, BoundToRuntimeAppPublic, app_crypto::{sr25519, ed25519}
};
pub struct KeyModule;
impl BoundToRuntimeAppPublic for KeyModule { type Public = ed25519::AppPublic; }
pub struct KeyModule2;
impl BoundToRuntimeAppPublic for KeyModule2 { type Public = sr25519::AppPublic; }
impl_opaque_keys! {
pub struct Keys {
pub key_module: KeyModule,
pub key_module2: KeyModule2,
}
}