Struct protoc::Protoc [−][src]
A builder for a protobuf compilation.
Implementations
impl Protoc
[src]
pub fn new() -> Self
[src]
Starts a new compilation.
pub fn include<S>(&mut self, include: S) -> &mut Self where
S: Into<PathBuf>,
[src]
S: Into<PathBuf>,
Adds an include path to the compilation.
pub fn input<S>(&mut self, input: S) -> &mut Self where
S: Into<PathBuf>,
[src]
S: Into<PathBuf>,
Adds an input file to the compilation.
pub fn serde(&mut self, set: bool) -> &mut Self
[src]
Enables or disables serde
support.
pub fn compile_into(&mut self, out_dir: &Path) -> Result<(), Error>
[src]
Executes the compilation.
The generated files are placed into out_dir
according to the
conventions of the [protoc_codegen_pure
]. Rougly speaking, for each
input file path/to/file.proto
, this method generates the Rust file
OUT_DIR/path/to/file.rs
. The details involve some special rules for
escaping Rust keywords and special characters, but you will have to
consult the protoc_codegen_pure
source code for details.
pub fn build_script_exec(&mut self) -> !
[src]
Executes the compilation, following build script conventions for input and output.
This is roughly equivalent to calling
compile_into
, with the following adjustments.
-
The directory to generate into is read from the environment variable
OUT_DIR
. -
If an error occurs, instead of returning the error, the error is printed to stderr and the process is aborted.
-
If the compilation is Serde-enabled, Cargo will be instructed to enable the
with-serde
feature to work around a bug inprotobuf_codegen_pure
. -
Various diagnostic information is printed to stdout for users following along with e.g.
cargo build -vv
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Protoc
[src]
impl Send for Protoc
[src]
impl Sync for Protoc
[src]
impl Unpin for Protoc
[src]
impl UnwindSafe for Protoc
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,