Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,28 @@
|
|||
trait PrintType {
|
||||
fn print_type(&self);
|
||||
}
|
||||
|
||||
impl PrintType for char {
|
||||
fn print_type(&self) {
|
||||
println!("char");
|
||||
}
|
||||
}
|
||||
|
||||
impl PrintType for f64 {
|
||||
fn print_type(&self) {
|
||||
println!("64-bit float");
|
||||
}
|
||||
}
|
||||
|
||||
fn prints_type_of_args<T, U>(arg1: &T, arg2: &U)
|
||||
where T: PrintType,
|
||||
U: PrintType
|
||||
{
|
||||
arg1.print_type();
|
||||
arg2.print_type();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
prints_type_of_args(&'a', &2.0);
|
||||
prints_type_of_args(&'a', &'b');
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue