pub trait FfiBinding: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn source_lang(&self) -> &'static str;
fn target_lang(&self) -> &'static str;
fn detect_in_build_file(&self, path: &Path, content: &str) -> Option<String>;
fn consumer_extensions(&self) -> &[&'static str];
fn matches_import(
&self,
import_module: &str,
import_name: &str,
known_module: &str,
) -> bool;
}Expand description
Trait for FFI binding detection.
Each binding type (PyO3, wasm-bindgen, etc.) implements this trait to describe how to detect it in a project.
Required Methods§
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
Unique identifier for this binding type (e.g., “pyo3”, “wasm-bindgen”)
Sourcefn source_lang(&self) -> &'static str
fn source_lang(&self) -> &'static str
Source language for this binding (e.g., “rust”)
Sourcefn target_lang(&self) -> &'static str
fn target_lang(&self) -> &'static str
Target language for this binding (e.g., “python”)
Sourcefn detect_in_build_file(&self, path: &Path, content: &str) -> Option<String>
fn detect_in_build_file(&self, path: &Path, content: &str) -> Option<String>
Check if a build file (e.g., Cargo.toml) indicates this binding is used. Returns the module name if detected.
Sourcefn consumer_extensions(&self) -> &[&'static str]
fn consumer_extensions(&self) -> &[&'static str]
File extensions that may contain imports of this binding’s modules.