pub trait StdlibPlugin {
// Required methods
fn register_mappings(&self, registry: &mut StdlibMappings);
fn name(&self) -> &str;
// Provided method
fn version(&self) -> &str { ... }
}Expand description
Plugin trait for extending stdlib mappings
Implement this trait to add custom Python→Rust API mappings.
§Example
use depyler_core::stdlib_mappings::{StdlibPlugin, StdlibMappings, StdlibApiMapping, RustPattern};
struct RequestsPlugin;
impl StdlibPlugin for RequestsPlugin {
fn register_mappings(&self, registry: &mut StdlibMappings) {
registry.register(StdlibApiMapping {
module: "requests",
class: "Session",
python_attr: "get",
rust_pattern: RustPattern::MethodCall {
method: "get",
extra_args: vec![],
propagate_error: true,
},
});
}
fn name(&self) -> &str {
"requests"
}
}Required Methods§
Sourcefn register_mappings(&self, registry: &mut StdlibMappings)
fn register_mappings(&self, registry: &mut StdlibMappings)
Register this plugin’s mappings into the registry