Trait Generate

Source
pub trait Generate {
    // Required methods
    fn bindings(
        &mut self,
        _pkg: &Package,
        _config: &mut Config,
    ) -> Result<(), Error>;
    fn array_type(
        &mut self,
        pkg: &Package,
        config: &mut Config,
        name: &str,
        ty: &ArrayType,
    ) -> Result<(), Error>;
    fn opaque_type(
        &mut self,
        pkg: &Package,
        config: &mut Config,
        name: &str,
        ty: &OpaqueType,
    ) -> Result<(), Error>;
    fn entry(
        &mut self,
        pkg: &Package,
        config: &mut Config,
        name: &str,
        entry: &Entry,
    ) -> Result<(), Error>;

    // Provided methods
    fn generate(
        &mut self,
        pkg: &Package,
        config: &mut Config,
    ) -> Result<(), Error> { ... }
    fn format(&mut self, _output: &Path) -> Result<(), Error> { ... }
}

Required Methods§

Source

fn bindings( &mut self, _pkg: &Package, _config: &mut Config, ) -> Result<(), Error>

Step 1: generate any setup code or low-level bindings

Source

fn array_type( &mut self, pkg: &Package, config: &mut Config, name: &str, ty: &ArrayType, ) -> Result<(), Error>

Step 2: generate code for array types

Source

fn opaque_type( &mut self, pkg: &Package, config: &mut Config, name: &str, ty: &OpaqueType, ) -> Result<(), Error>

Step 3: generate code for opaque types

Source

fn entry( &mut self, pkg: &Package, config: &mut Config, name: &str, entry: &Entry, ) -> Result<(), Error>

Step 4: generate code for entry points

Provided Methods§

Source

fn generate(&mut self, pkg: &Package, config: &mut Config) -> Result<(), Error>

Iterates through the manifest and generates code

Source

fn format(&mut self, _output: &Path) -> Result<(), Error>

Step 5: Optionally, run any formatting program or post-processing on the output file

Implementors§