#[capnp]Expand description
Generate Cap’n Proto schema from an impl block.
§Example
ⓘ
use server_less::capnp;
struct UserService;
#[capnp(id = "0x85150b117366d14b")]
impl UserService {
/// Get user by ID
fn get_user(&self, id: String) -> String { ... }
/// Create a new user
fn create_user(&self, name: String, email: String) -> String { ... }
}
// Get the Cap'n Proto schema
let schema = UserService::capnp_schema();
// Write to file for use with capnpc
UserService::write_capnp("schema/users.capnp")?;The generated schema can be used with capnpc to generate the full Cap’n Proto serialization code.