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§
Sourcefn bindings(
&mut self,
_pkg: &Package,
_config: &mut Config,
) -> Result<(), Error>
fn bindings( &mut self, _pkg: &Package, _config: &mut Config, ) -> Result<(), Error>
Step 1: generate any setup code or low-level bindings
Sourcefn array_type(
&mut self,
pkg: &Package,
config: &mut Config,
name: &str,
ty: &ArrayType,
) -> Result<(), Error>
fn array_type( &mut self, pkg: &Package, config: &mut Config, name: &str, ty: &ArrayType, ) -> Result<(), Error>
Step 2: generate code for array types
Sourcefn opaque_type(
&mut self,
pkg: &Package,
config: &mut Config,
name: &str,
ty: &OpaqueType,
) -> Result<(), Error>
fn opaque_type( &mut self, pkg: &Package, config: &mut Config, name: &str, ty: &OpaqueType, ) -> Result<(), Error>
Step 3: generate code for opaque types