pub struct CodeGenerationCommand { /* private fields */ }
Expand description

An invocation of the capnpc-rust code generation plugin.

Implementations§

source§

impl CodeGenerationCommand

source

pub fn new() -> Self

Creates a new code generation command with default options.

source

pub fn output_directory<P>(&mut self, path: P) -> &mut Selfwhere P: AsRef<Path>,

Sets the output directory.

source

pub fn default_parent_module( &mut self, default_parent_module: Vec<String> ) -> &mut Self

Sets the default parent module, indicating the scope in your crate where you will add the generated code.

This option can be overridden by the parentModule annotation defined in rust.capnp.

source

pub fn capnp_root(&mut self, capnp_root: &str) -> &mut Self

Sets the root path for referencing things in the capnp crate from the generated code. Usually this is ::capnp. When we bootstrap schema.capnp we set this to crate. If you are renaming the capnp crate when importing it, then you probably want to set this value.

source

pub fn raw_code_generator_request_path<P>(&mut self, path: P) -> &mut Selfwhere P: AsRef<Path>,

Sets the raw code generator request output path.

source

pub fn run<T>(&mut self, inp: T) -> Result<()>where T: Read,

Generates Rust code according to a schema_capnp::code_generator_request read from inp.

Trait Implementations§

source§

impl Default for CodeGenerationCommand

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.