change text -> content to match the row names

This commit is contained in:
Adrian Malacoda 2017-02-22 23:36:58 -06:00
parent ab199a8350
commit ede641995a
2 changed files with 4 additions and 4 deletions

View File

@ -43,7 +43,7 @@ impl Echobox {
while let Some(row) = cursor.next().unwrap() {
quotes.push(Quote {
id: row[0].as_integer().expect("Expected rowid in row"),
text: String::from(row[1].as_string().expect("Expected text in row"))
content: String::from(row[1].as_string().expect("Expected content in row"))
});
}
Result::Ok(quotes)
@ -64,11 +64,11 @@ impl From<sqlite::Error> for Error {
#[derive(Debug, Clone)]
pub struct Quote {
pub id: i64,
pub text: String
pub content: String
}
impl std::fmt::Display for Quote {
fn fmt (&self, formatter: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
write!(formatter, "{}", self.text)
write!(formatter, "{}", self.content)
}
}

View File

@ -15,5 +15,5 @@ fn main () {
let in_quote = &env::args().nth(1).expect("Expected quote as first argument.")[..];
let echobox = Echobox::with_file(ECHOBOX_FILE).unwrap();
let out_quote = echobox.echo(in_quote).unwrap();
println!("{}: {}", out_quote.id, out_quote.text);
println!("{}: {}", out_quote.id, out_quote.content);
}