Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
19 lines (16 sloc) 431 Bytes
struct State {
already_greeted: Vec<String>
}
impl State {
pub fn new() -> State {
State {
already_greeted : Vec::new()
}
}
fn greetings(&mut self, name:String) -> String {
let ag = self.already_greeted.join(", ");
let greeting = format!("Hello {}\nI already greeted all these guys: [{}]\n", name, ag);
self.already_greeted.push(name);
greeting
}
}
You can’t perform that action at this time.