Struct capnpc::CompilerCommand
source · [−]pub struct CompilerCommand { /* private fields */ }
Expand description
A builder object for schema compiler commands.
Implementations
sourceimpl CompilerCommand
impl CompilerCommand
sourcepub fn new() -> CompilerCommand
pub fn new() -> CompilerCommand
Creates a new, empty command.
sourcepub fn file<P>(&mut self, path: P) -> &mut CompilerCommand where
P: AsRef<Path>,
pub fn file<P>(&mut self, path: P) -> &mut CompilerCommand where
P: AsRef<Path>,
Adds a file to be compiled.
sourcepub fn src_prefix<P>(&mut self, prefix: P) -> &mut CompilerCommand where
P: AsRef<Path>,
pub fn src_prefix<P>(&mut self, prefix: P) -> &mut CompilerCommand where
P: AsRef<Path>,
Adds a –src-prefix flag. For all files specified for compilation that start
with prefix
, removes the prefix when computing output filenames.
sourcepub fn import_path<P>(&mut self, dir: P) -> &mut CompilerCommand where
P: AsRef<Path>,
pub fn import_path<P>(&mut self, dir: P) -> &mut CompilerCommand where
P: AsRef<Path>,
Adds an –import_path flag. Adds dir
to the list of directories searched
for absolute imports.
sourcepub fn no_standard_import(&mut self) -> &mut CompilerCommand
pub fn no_standard_import(&mut self) -> &mut CompilerCommand
Adds the –no-standard-import flag, indicating that the default import paths of /usr/include and /usr/local/include should not bet included.
sourcepub fn output_path<P>(&mut self, path: P) -> &mut CompilerCommand where
P: AsRef<Path>,
pub fn output_path<P>(&mut self, path: P) -> &mut CompilerCommand where
P: AsRef<Path>,
Sets the output directory of generated code. Default is OUT_DIR
sourcepub fn capnp_executable<P>(&mut self, path: P) -> &mut CompilerCommand where
P: AsRef<Path>,
pub fn capnp_executable<P>(&mut self, path: P) -> &mut CompilerCommand where
P: AsRef<Path>,
Specify the executable which is used for the ‘capnp’ tool. When this method is not called, the command looks for a name ‘capnp’ on the system (e.g. in working directory or in PATH environment variable).
sourcepub fn default_parent_module(
&mut self,
default_parent_module: Vec<String>
) -> &mut CompilerCommand
pub fn default_parent_module(
&mut self,
default_parent_module: Vec<String>
) -> &mut CompilerCommand
Sets the default parent module. This indicates the scope in your crate where you will
add a module containing the generated code. For example, if you set this option to
vec!["foo".into(), "bar".into()]
, and you are generating code for baz.capnp
, then your crate
should have this structure:
pub mod foo {
pub mod bar {
pub mod baz_capnp {
include!(concat!(env!("OUT_DIR"), "/baz_capnp.rs"));
}
}
}
This option can be overridden by the parentModule
annotation defined in rust.capnp
.
If this option is unset, the default is the crate root.
sourcepub fn raw_code_generator_request_path<P>(
&mut self,
path: P
) -> &mut CompilerCommand where
P: AsRef<Path>,
pub fn raw_code_generator_request_path<P>(
&mut self,
path: P
) -> &mut CompilerCommand where
P: AsRef<Path>,
If set, the generator will also write a file containing the raw code generator request to the specified path.
Auto Trait Implementations
impl RefUnwindSafe for CompilerCommand
impl Send for CompilerCommand
impl Sync for CompilerCommand
impl Unpin for CompilerCommand
impl UnwindSafe for CompilerCommand
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more