Expand description
Proc-macros for moonpool RPC interfaces.
This crate provides the #[service] attribute macro for generating
RPC server/client boilerplate from a trait definition.
§Example
ⓘ
use moonpool_transport::{service, RpcError};
#[service(id = 0xCA1C_0000)]
trait Calculator {
async fn add(&self, req: AddRequest) -> Result<AddResponse, RpcError>;
async fn sub(&self, req: SubRequest) -> Result<SubResponse, RpcError>;
}This generates:
CalculatorServer<C>withRequestStreamfields,init(), andserve()CalculatorClientwithServiceEndpointfields for each method- The trait itself with
#[async_trait(?Send)]
Attribute Macros§
- service
- Attribute macro for defining RPC service interfaces.