Skip to main content

Crate hyprstream_rpc_derive

Crate hyprstream_rpc_derive 

Source
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.

Derive Macros§

FromCapnp
Derive macro for deserializing Cap’n Proto to Rust types.
ToCapnp
Derive macro for serializing Rust types to Cap’n Proto.