change text -> content to match the row names
This commit is contained in:
parent
ab199a8350
commit
ede641995a
@ -43,7 +43,7 @@ impl Echobox {
|
|||||||
while let Some(row) = cursor.next().unwrap() {
|
while let Some(row) = cursor.next().unwrap() {
|
||||||
quotes.push(Quote {
|
quotes.push(Quote {
|
||||||
id: row[0].as_integer().expect("Expected rowid in row"),
|
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)
|
Result::Ok(quotes)
|
||||||
@ -64,11 +64,11 @@ impl From<sqlite::Error> for Error {
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Quote {
|
pub struct Quote {
|
||||||
pub id: i64,
|
pub id: i64,
|
||||||
pub text: String
|
pub content: String
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Display for Quote {
|
impl std::fmt::Display for Quote {
|
||||||
fn fmt (&self, formatter: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
fn fmt (&self, formatter: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
||||||
write!(formatter, "{}", self.text)
|
write!(formatter, "{}", self.content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,5 +15,5 @@ fn main () {
|
|||||||
let in_quote = &env::args().nth(1).expect("Expected quote as first argument.")[..];
|
let in_quote = &env::args().nth(1).expect("Expected quote as first argument.")[..];
|
||||||
let echobox = Echobox::with_file(ECHOBOX_FILE).unwrap();
|
let echobox = Echobox::with_file(ECHOBOX_FILE).unwrap();
|
||||||
let out_quote = echobox.echo(in_quote).unwrap();
|
let out_quote = echobox.echo(in_quote).unwrap();
|
||||||
println!("{}: {}", out_quote.id, out_quote.text);
|
println!("{}: {}", out_quote.id, out_quote.content);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user