Trait PreimageOracleClient

Source
pub trait PreimageOracleClient {
    // Required methods
    fn get<'life0, 'async_trait>(
        &'life0 self,
        key: PreimageKey,
    ) -> Pin<Box<dyn Future<Output = PreimageOracleResult<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_exact<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: PreimageKey,
        buf: &'life1 mut [u8],
    ) -> Pin<Box<dyn Future<Output = PreimageOracleResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A PreimageOracleClient is a high-level interface to read data from the host, keyed by a PreimageKey.

Required Methods§

Source

fn get<'life0, 'async_trait>( &'life0 self, key: PreimageKey, ) -> Pin<Box<dyn Future<Output = PreimageOracleResult<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the data corresponding to the currently set key from the host. Return the data in a new heap allocated Vec<u8>

§Returns
  • Ok(Vec<u8>) if the data was successfully fetched from the host.
  • Err(_) if the data could not be fetched from the host.
Source

fn get_exact<'life0, 'life1, 'async_trait>( &'life0 self, key: PreimageKey, buf: &'life1 mut [u8], ) -> Pin<Box<dyn Future<Output = PreimageOracleResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the data corresponding to the currently set key from the host. Writes the data into the provided buffer.

§Returns
  • Ok(()) if the data was successfully written into the buffer.
  • Err(_) if the data could not be written into the buffer.

Implementors§