Expand description
§actr-web-protoc-codegen
Protoc code generator for producing actr-web code from Protobuf definitions.
§Features
- Generate Rust WASM actor code from
.protofiles - Generate TypeScript type definitions
- Generate TypeScript ActorRef wrappers
- Optionally generate React Hooks
§Usage
§Option 1: use it from build.rs
use actr_web_protoc_codegen::{WebCodegen, WebCodegenConfig};
let config = WebCodegenConfig {
proto_files: vec!["proto/echo.proto".into()],
rust_output_dir: "src/generated".into(),
ts_output_dir: "../packages/web-sdk/src/generated".into(),
generate_react_hooks: true,
includes: vec!["proto".into()],
custom_templates_dir: None,
format_code: true,
};
WebCodegen::new(config)
.generate()
.expect("Failed to generate code");§Option 2: use it through actr-cli
actr gen --platform web \
--input proto/ \
--output crates/actors/src/generated/ \
--ts-output packages/web-sdk/src/generated/ \
--react-hooksModules§
- descriptor
- Descriptor-based proto parsing.
Structs§
- Generated
File - A single generated file.
- Generated
Files - All files generated in a run.
- Proto
Field - Proto field definition.
- Proto
Message - Proto message definition.
- Proto
Method - Proto method definition.
- Proto
Service - Proto service definition.
- WebCodegen
- Code generator for the web platform.
- WebCodegen
Config - Configuration for web code generation.
- WebCodegen
Config Builder - Configuration builder.
- WebCodegen
Request - Complete request from CLI to plugin
Functions§
- generate
- Run the full code generation pipeline.