#[path = "module-polymorphism-files"] mod my_float { #[legacy_exports]; // The type of the float use inst::T; // Define T as float #[path = "inst_float.rs"] #[legacy_exports] mod inst; // Add in the implementation from a single source file #[path = "template.rs"] #[legacy_exports] mod template; } #[path = "module-polymorphism-files"] mod my_f64 { #[legacy_exports]; use inst::T; // Define T as f64 #[path = "inst_f64.rs"] #[legacy_exports] mod inst; // Use the implementation for the same source file! #[path = "template.rs"] #[legacy_exports] mod template; } #[path = "module-polymorphism-files"] mod my_f32 { #[legacy_exports]; use inst::T; #[path = "inst_f32.rs"] #[legacy_exports] mod inst; #[path = "template.rs"] #[legacy_exports] mod template; }