pub trait BindingGenerator: Sized {
    type Config: BindingsConfig;

    // Required methods
    fn write_bindings(
        &self,
        ci: &ComponentInterface,
        config: &Self::Config,
        out_dir: &Utf8Path,
        try_format_code: bool
    ) -> Result<()>;
    fn check_library_path(
        &self,
        library_path: &Utf8Path,
        cdylib_name: Option<&str>
    ) -> Result<()>;
}
Expand description

A trait representing a UniFFI Binding Generator

External crates that implement binding generators, should implement this type and call the generate_external_bindings using a type that implements this trait.

Required Associated Types§

source

type Config: BindingsConfig

Handles configuring the bindings

Required Methods§

source

fn write_bindings( &self, ci: &ComponentInterface, config: &Self::Config, out_dir: &Utf8Path, try_format_code: bool ) -> Result<()>

Writes the bindings to the output directory

§Arguments
  • ci: A ComponentInterface representing the interface
  • config: An instance of the BindingsConfig associated with this type
  • out_dir: The path to where the binding generator should write the output bindings
source

fn check_library_path( &self, library_path: &Utf8Path, cdylib_name: Option<&str> ) -> Result<()>

Check if library_path used by library mode is valid for this generator

Object Safety§

This trait is not object safe.

Implementors§