#[service]Expand description
Generates RPC client and server from a trait definition.
§Example
ⓘ
#[rapace::service]
trait Calculator {
async fn add(&self, a: i32, b: i32) -> i32;
}
// Generated:
// - CalculatorClient<T: Transport> with async fn add(&self, a: i32, b: i32) -> Result<i32, RpcError>
// - CalculatorServer<S: Calculator> with dispatch method§Streaming RPCs
For server-streaming, return Streaming<T>:
ⓘ
use rapace_core::Streaming;
#[rapace::service]
trait RangeService {
async fn range(&self, n: u32) -> Streaming<u32>;
}The client method becomes:
async fn range(&self, n: u32) -> Result<Streaming<u32>, RpcError>