Skip to content
プロジェクト

概要

A protoc plugin that generates code using the Prost! code generation engine.

開発ツール

この数値の測り方

計測したスター増加

24時間
0
7日間
0
15日間
0
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

protoc-gen-prost

A protoc plugin that generates code using the Prost! code generation engine.

When used in projects that use only Rust code, the preferred mechanism for generating protobuf definitions with Prost! is to use prost-build from within a build.rs file. However, when working in polyglot environments, it can be advantageous to utilize common tooling in the Protocol Buffers ecosystem. One common tool used for this purpose is buf, which simplifies the code generation process and includes several useful features, including linting, package management, and breaking change detection.

Usage

The various modules that are used for generating Rust code with Prost! and Tonic are available in the named subdirectories. Refer to the README in each of those folders for more information.

Example buf.gen.yaml

Note: When executing protoc-gen-prost-crate with the gen_crate option, remote generation is not possible, as the manifest template is not made available to a remote plugin.

version: v2
plugins:
  - remote: buf.build/community/neoeinstein-prost:v0.4.0
    out: gen/src
    opt:
      - bytes=.
      - compile_well_known_types
      - extern_path=.google.protobuf=::pbjson_types
      - file_descriptor_set
  - remote: buf.build/community/neoeinstein-prost-serde:v0.3.1
    out: gen/src
  - remote: buf.build/community/neoeinstein-tonic:v0.4.1
    out: gen/src
    opt:
      - compile_well_known_types
      - extern_path=.google.protobuf=::pbjson_types
  - local: protoc-gen-prost-crate
    out: gen
    strategy: all
    opt:
      - gen_crate=Cargo.toml

See example/build-with-buf for an example of invoking buf as part of a build.rs build script. This may be useful when you want to extend the generated files with additional trait or inherent implementations.

See example/wkt-reflection-with-buf for registering well-known type file descriptor sets from protoc-wkt when exposing a gRPC reflection endpoint.

関連プロジェクトを探す

読み込み中…