Skip to main content

Crate actr_web_protoc_codegen

Crate actr_web_protoc_codegen 

Source
Expand description

§actr-web-protoc-codegen

Protoc code generator for producing actr-web code from Protobuf definitions.

§Features

  • Generate Rust WASM actor code from .proto files
  • 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-hooks

Modules§

descriptor
Descriptor-based proto parsing.

Structs§

GeneratedFile
A single generated file.
GeneratedFiles
All files generated in a run.
ProtoField
Proto field definition.
ProtoMessage
Proto message definition.
ProtoMethod
Proto method definition.
ProtoService
Proto service definition.
WebCodegen
Code generator for the web platform.
WebCodegenConfig
Configuration for web code generation.
WebCodegenConfigBuilder
Configuration builder.
WebCodegenRequest
Complete request from CLI to plugin

Functions§

generate
Run the full code generation pipeline.