sp_messenger_host_functions/
runtime_interface.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#[cfg(feature = "std")]
use crate::host_functions::MessengerExtension;
use crate::StorageKeyRequest;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
#[cfg(feature = "std")]
use sp_externalities::ExternalitiesExt;
use sp_runtime_interface::runtime_interface;

/// Messenger related runtime interface
#[runtime_interface]
pub trait MessengerRuntimeInterface {
    /// Returns the storage key.
    fn get_storage_key(&mut self, req: StorageKeyRequest) -> Option<Vec<u8>> {
        self.extension::<MessengerExtension>()
            .expect("No `MessengerExtension` associated for the current context!")
            .get_storage_key(req)
    }
}