From 6e5cbc5b467dbe0e6cae428895e749772d5674e0 Mon Sep 17 00:00:00 2001 From: LOU Xun Date: Mon, 12 Jul 2021 15:27:30 +0000 Subject: [PATCH] Split path types in compile Same idea as https://github.com/tokio-rs/prost/pull/496 --- tonic-build/src/prost.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tonic-build/src/prost.rs b/tonic-build/src/prost.rs index 251dace7a..eb5652434 100644 --- a/tonic-build/src/prost.rs +++ b/tonic-build/src/prost.rs @@ -368,24 +368,22 @@ impl Builder { } /// Compile the .proto files and execute code generation. - pub fn compile

(self, protos: &[P], includes: &[P]) -> io::Result<()> - where - P: AsRef, - { + pub fn compile( + self, + protos: &[impl AsRef], + includes: &[impl AsRef], + ) -> io::Result<()> { self.compile_with_config(Config::new(), protos, includes) } /// Compile the .proto files and execute code generation using a /// custom `prost_build::Config`. - pub fn compile_with_config

( + pub fn compile_with_config( self, mut config: Config, - protos: &[P], - includes: &[P], - ) -> io::Result<()> - where - P: AsRef, - { + protos: &[impl AsRef], + includes: &[impl AsRef], + ) -> io::Result<()> { let out_dir = if let Some(out_dir) = self.out_dir.as_ref() { out_dir.clone() } else {