Skip to content

Commit

Permalink
feat(build): Expose Prost generation plugin (#947)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuetuopay authored Mar 31, 2022
1 parent 9dab8be commit d4bd475
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tonic-build/src/prost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,16 @@ impl Builder {
config.protoc_arg(arg);
}

config.service_generator(Box::new(ServiceGenerator::new(self)));
config.service_generator(self.service_generator());

config.compile_protos(protos, includes)?;

Ok(())
}

/// Turn the builder into a `ServiceGenerator` ready to be passed to `prost-build`s
/// `Config::service_generator`.
pub fn service_generator(self) -> Box<dyn prost_build::ServiceGenerator> {
Box::new(ServiceGenerator::new(self))
}
}

0 comments on commit d4bd475

Please sign in to comment.