今天在地铁上被干了5次。

#[allow(dead_code)]
struct Bitter{
    id: i32,
    name: &'static str,
    worlds: &'static str,
    sex: &'static str,
}
#[allow(dead_code)]
impl Bitter{
    pub fn new(id_t:i32,name_t:&'static str,worlds_t:&'static str,sex_t:&'static str)->Bitter{
        Bitter{
            id : id_t,
            name : name_t,
            worlds : worlds_t,
            sex : sex_t,
        }
    }
    pub fn beat(&self){
        println!("{} beat my shoes,it's {},and it sad {} ", self.name,self.sex,self.worlds);
    }
}
    
fn main() {
    println!("Today,i had attacked five times in the subway,as follows:");
    let somethings = vec![
        Bitter::new(1,"A_Fool1","What' wrong?","Male"),
        Bitter::new(2,"A_Fool2","WOW!That's a big shoe,right here.","Male"),
        Bitter::new(3,"A_Fool3","Come on,girl,give me more!!!Oh~~oh~~","Female"),
        Bitter::new(4,"A_Fool4","You make it gone,stop walking,and wear it.Yes,i really want give you a kiss,man!","Male"),
        Bitter::new(5,"A_Fool5","He attacks my left leg,like a bullet,and say nothing,like a mut.","Male"),
    ];

    for p in &somethings {
        p.beat();
    }
    
    println!("What a nice day!");
}

你可能感兴趣的:(Rust)