ttrpc_compiler/
lib.rs

1// Copyright 2017 PingCAP, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14//!
15//! A compiler of ttrpc-rust.
16//!
17//! *generate rust version ttrpc code from proto files.*
18//!
19//!
20//! Usage
21//!
22//!- [Manual Generation](https://github.com/containerd/ttrpc-rust#1-generate-with-protoc-command) uses ttrpc-compiler as a protoc plugin
23//!
24//!- [Programmatic Generation](https://github.com/containerd/ttrpc-rust#2-generate-programmatically) uses ttrpc-compiler as a rust crate
25
26pub mod codegen;
27pub mod prost_codegen;
28mod util;
29
30/// Customize generated code.
31#[derive(Default, Debug, Clone)]
32pub struct Customize {
33    /// Indicates whether to generate async code for both server and client.
34    pub async_all: bool,
35    /// Indicates whether to  generate async code for client.
36    pub async_client: bool,
37    /// Indicates whether to generate async code for server.
38    pub async_server: bool,
39    /// Gen mod rs in mod.rs
40    pub gen_mod: bool,
41}