1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
use std::string::String; pub struct Prompt { pub buffer: String, } impl Prompt { pub fn new() -> Prompt { let prompt = Prompt { buffer: String::from(""), }; prompt } pub fn insert_char(&mut self, c: char) { self.buffer.push(c); } }