1 use crate::utils::cargo_handler::{CargoHandler, TargetArch}; 2 3 use self::x86_64::X86_64BindgenArch; 4 5 pub mod x86_64; 6 7 pub(super) trait BindgenArch { 8 fn generate_bindings(&self, builder: bindgen::Builder) -> bindgen::Builder; 9 } 10 11 /// 获取当前的bindgen架构; 12 pub(super) fn current_bindgenarch() -> &'static dyn BindgenArch { 13 let arch = CargoHandler::target_arch(); 14 match arch { 15 TargetArch::X86_64 => &X86_64BindgenArch, 16 _ => panic!("Unsupported arch: {:?}", arch), 17 } 18 } 19