| // Use one template module to specify in a single file the implementation |
| // of functions for multiple types |
| |
| #[path = "module-polymorphism3-files"] |
| mod mystd { |
| #[legacy_exports]; |
| |
| // The template is specified in float-template.rs |
| #[path = "float-template"] |
| mod float { |
| #[legacy_exports]; |
| // The type of the float |
| use inst::T; |
| |
| // Define T as appropriate for platform |
| #[path = "inst_float.rs"] |
| mod inst; |
| } |
| |
| // Use the same template |
| #[path = "float-template"] |
| mod f64 { |
| #[legacy_exports]; |
| |
| use inst::T; |
| |
| // Define T as f64 |
| #[path = "inst_f64.rs"] |
| mod inst; |
| } |
| |
| #[path = "float-template"] |
| mod f32 { |
| #[legacy_exports]; |
| use inst::T; |
| |
| #[path = "inst_f32.rs"] |
| mod inst; |
| } |
| |
| } |