#[rpc]Expand description
Blessed preset: JSON-RPC server with OpenRPC spec and serve.
Combines #[jsonrpc] + #[openrpc] + #[serve(jsonrpc)] into a single attribute.
OpenRPC and serve are included when their features are enabled, and gracefully
omitted otherwise.
§Example
ⓘ
use server_less::rpc;
#[derive(Clone)]
struct Calculator;
#[rpc]
impl Calculator {
pub fn add(&self, a: i32, b: i32) -> i32 { a + b }
pub fn multiply(&self, a: i32, b: i32) -> i32 { a * b }
}§Options
path- JSON-RPC endpoint path (e.g.,#[rpc(path = "/api")])openrpc- Toggle OpenRPC spec generation (default: true)health- Custom health check path (default:/health)