Trait OffchainApiServer
pub trait OffchainApiServer:
Sized
+ Send
+ Sync
+ 'static {
// Required methods
fn set_local_storage(
&self,
ext: &Extensions,
kind: StorageKind,
key: Bytes,
value: Bytes,
) -> Result<(), Error>;
fn clear_local_storage(
&self,
ext: &Extensions,
kind: StorageKind,
key: Bytes,
) -> Result<(), Error>;
fn get_local_storage(
&self,
ext: &Extensions,
kind: StorageKind,
key: Bytes,
) -> Result<Option<Bytes>, Error>;
// Provided method
fn into_rpc(self) -> RpcModule<Self> { ... }
}
Expand description
Re-export the API for backward compatibility.
Server trait implementation for the OffchainApi
RPC API.
Required Methods§
fn set_local_storage(
&self,
ext: &Extensions,
kind: StorageKind,
key: Bytes,
value: Bytes,
) -> Result<(), Error>
fn set_local_storage( &self, ext: &Extensions, kind: StorageKind, key: Bytes, value: Bytes, ) -> Result<(), Error>
Set offchain local storage under given key and prefix.
fn clear_local_storage(
&self,
ext: &Extensions,
kind: StorageKind,
key: Bytes,
) -> Result<(), Error>
fn clear_local_storage( &self, ext: &Extensions, kind: StorageKind, key: Bytes, ) -> Result<(), Error>
Clear offchain local storage under given key and prefix.
fn get_local_storage(
&self,
ext: &Extensions,
kind: StorageKind,
key: Bytes,
) -> Result<Option<Bytes>, Error>
fn get_local_storage( &self, ext: &Extensions, kind: StorageKind, key: Bytes, ) -> Result<Option<Bytes>, Error>
Get offchain local storage under given key and prefix.
Provided Methods§
fn into_rpc(self) -> RpcModule<Self>
fn into_rpc(self) -> RpcModule<Self>
Collects all the methods and subscriptions defined in the trait and adds them into a single RpcModule
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.