2012-04-14 01:27:03 -05:00
|
|
|
// Use one template module to specify in a single file the implementation
|
|
|
|
// of functions for multiple types
|
|
|
|
|
|
|
|
#[path = "module-polymorphism3-files"]
|
|
|
|
mod mystd {
|
|
|
|
|
|
|
|
// The template is specified in float-template.rs
|
|
|
|
#[path = "float-template"]
|
|
|
|
mod float {
|
|
|
|
// The type of the float
|
2012-09-07 20:08:21 -05:00
|
|
|
use inst::T;
|
2012-04-14 01:27:03 -05:00
|
|
|
|
|
|
|
// Define T as appropriate for platform
|
|
|
|
#[path = "inst_float.rs"]
|
|
|
|
mod inst;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Use the same template
|
|
|
|
#[path = "float-template"]
|
|
|
|
mod f64 {
|
|
|
|
|
2012-09-07 20:08:21 -05:00
|
|
|
use inst::T;
|
2012-04-14 01:27:03 -05:00
|
|
|
|
|
|
|
// Define T as f64
|
|
|
|
#[path = "inst_f64.rs"]
|
|
|
|
mod inst;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[path = "float-template"]
|
|
|
|
mod f32 {
|
2012-09-07 20:08:21 -05:00
|
|
|
use inst::T;
|
2012-04-14 01:27:03 -05:00
|
|
|
|
|
|
|
#[path = "inst_f32.rs"]
|
|
|
|
mod inst;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|