mirror of https://github.com/balkian/experiments
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
366 B
Rust
27 lines
366 B
Rust
use std::fmt::Debug;
|
|
|
|
#[derive(Debug)]
|
|
struct Prueba1<'a>(&'a str);
|
|
|
|
#[derive(Debug)]
|
|
struct Prueba2(usize);
|
|
|
|
trait GreetTrait: Debug {
|
|
fn greet(&self);
|
|
}
|
|
|
|
impl<T> GreetTrait for T
|
|
where T: Debug {
|
|
fn greet(&self){
|
|
println!("{:?}", self);
|
|
}
|
|
}
|
|
|
|
fn main(){
|
|
let p1 = Prueba1("hello");
|
|
let p2 = Prueba2(5);
|
|
|
|
p1.greet();
|
|
p2.greet();
|
|
}
|