Expand description
Derive macros for Cap’n Proto serialization.
Provides #[derive(ToCapnp)] and #[derive(FromCapnp)] for automatic
serialization/deserialization between Rust types and Cap’n Proto messages.
§Example
ⓘ
use hyprstream_rpc::prelude::*;
#[derive(ToCapnp)]
#[capnp(my_schema_capnp::my_request)]
pub struct MyRequest {
pub name: String,
pub count: u32,
}
#[derive(FromCapnp)]
#[capnp(my_schema_capnp::my_response)]
pub struct MyResponse {
pub result: String,
pub success: bool,
}Macros§
- generate_
rpc_ client - Generate client-only code from a Cap’n Proto service schema.
- generate_
rpc_ server - Proc macro that generates only the server implementation surface for a schema whose contracts live in another crate.
- generate_
rpc_ service
Attribute Macros§
- authorize
- Attribute macro for method-level authorization with structured scopes.
- register_
scopes - Attribute macro for automatic scope registration.
- service_
factory - Attribute macro for service factory registration.