pub struct CodeGenBuilder { /* private fields */ }Expand description
Builder for the generic code generation of server and clients.
Implementations§
Source§impl CodeGenBuilder
impl CodeGenBuilder
Sourcepub fn emit_package(&mut self, enable: bool) -> &mut Self
pub fn emit_package(&mut self, enable: bool) -> &mut Self
Enable code generation to emit the package name.
Sourcepub fn attributes(&mut self, attributes: Attributes) -> &mut Self
pub fn attributes(&mut self, attributes: Attributes) -> &mut Self
Attributes that will be added to mod and struct items.
Reference Attributes for more information.
Sourcepub fn build_transport(&mut self, build_transport: bool) -> &mut Self
pub fn build_transport(&mut self, build_transport: bool) -> &mut Self
Enable transport code to be generated, this requires tonic’s transport
feature.
This allows codegen level control of generating the transport code and is a work around when other crates in a workspace enable this feature.
Sourcepub fn compile_well_known_types(&mut self, enable: bool) -> &mut Self
pub fn compile_well_known_types(&mut self, enable: bool) -> &mut Self
Enable compiling well knonw types, this will force codegen to not
use the well known types from prost-types.
Sourcepub fn disable_comments(
&mut self,
disable_comments: HashSet<String>,
) -> &mut Self
pub fn disable_comments( &mut self, disable_comments: HashSet<String>, ) -> &mut Self
Disable comments based on a proto path.
Sourcepub fn use_arc_self(&mut self, enable: bool) -> &mut Self
pub fn use_arc_self(&mut self, enable: bool) -> &mut Self
Emit Arc<Self> instead of &self in servica trait.
Sourcepub fn generate_default_stubs(
&mut self,
generate_default_stubs: bool,
) -> &mut Self
pub fn generate_default_stubs( &mut self, generate_default_stubs: bool, ) -> &mut Self
Enable or disable returning automatic unimplemented gRPC error code for generated traits.
Sourcepub fn generate_server_definition(
&self,
service: &impl Service,
rewrite_crate: &str,
proto_path: &str,
) -> TokenStream
pub fn generate_server_definition( &self, service: &impl Service, rewrite_crate: &str, proto_path: &str, ) -> TokenStream
Generate server interface definition based on Service.
This takes some Service and will generate a TokenStream that contains
a public module with the generated service definition.
Trait Implementations§
Source§impl Debug for CodeGenBuilder
impl Debug for CodeGenBuilder
Auto Trait Implementations§
impl Freeze for CodeGenBuilder
impl RefUnwindSafe for CodeGenBuilder
impl Send for CodeGenBuilder
impl Sync for CodeGenBuilder
impl Unpin for CodeGenBuilder
impl UnwindSafe for CodeGenBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more