Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tonic-build/src/code_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct CodeGenBuilder {
disable_comments: HashSet<String>,
use_arc_self: bool,
generate_default_stubs: bool,
async_trait: bool,
}

impl CodeGenBuilder {
Expand Down Expand Up @@ -76,6 +77,12 @@ impl CodeGenBuilder {
self
}

/// Enable or disable the use of the `async_trait` crate for generated traits.
pub fn async_trait(&mut self, enable: bool) -> &mut Self {
self.async_trait = enable;
self
}

/// Generate client code based on `Service`.
///
/// This takes some `Service` and will generate a `TokenStream` that contains
Expand Down Expand Up @@ -106,6 +113,7 @@ impl CodeGenBuilder {
&self.disable_comments,
self.use_arc_self,
self.generate_default_stubs,
self.async_trait,
)
}
}
Expand All @@ -120,6 +128,7 @@ impl Default for CodeGenBuilder {
disable_comments: HashSet::default(),
use_arc_self: false,
generate_default_stubs: false,
async_trait: true,
}
}
}
Loading
Loading