fn print_matching_words(conn: &Connection, word: &str, all: bool) -> rusqlite::Result<()> {
    let query = if all {
        SQL_ALL_WORD_SENTENCES
    } else {
        SQL_BEST_WORD_SENTENCES
    };
    let mut stmt = conn.prepare_cached(query)?;
    let results = stmt.query_map(params![word], |row| row.get(0))?;
    for r in results {
        let r: String = r?;
        if let Err(e) = write!(io::stdout(), "{}\n", r) {
            if e.kind() != io::ErrorKind::BrokenPipe {
                panic!(e);
            }
        }
    }
    Ok(())
}
// This will ignore broken pipes, to support unix piping into things like head
This will ignore broken pipes, to support unix piping into things like head
This will ignore broken pipes to support unix piping into things like head
fn print_matching_words(conn: &Connection, word: &str, all: bool) -> rusqlite::Result<()> {
    let query = if all {
        SQL_ALL_WORD_SENTENCES
    } else {
        SQL_BEST_WORD_SENTENCES
    };
    let mut stmt = conn.prepare_cached(query)?;
    let results = stmt.query_map(params![word], |row| row.get(0))?;
    for r in results {
        let r: String = r?;
        if let Err(e) = write!(io::stdout(), "{}\n", r) {
            if e.kind() != io::ErrorKind::BrokenPipe {
                panic!(e);
            }
        }
    }
    Ok(())
}
fn print_matching_words ( conn : & Connection , word : & str , all : bool ) -> rusqlite :: Result < ( ) > { let query = if all { SQL_ALL_WORD_SENTENCES } else { SQL_BEST_WORD_SENTENCES } ; let mut stmt = conn . prepare_cached ( query ) ? ; let results = stmt . query_map ( params ! [ word ] , | row | row . get ( 0 ) ) ? ; for r in results { let r : String = r ? ; if let Err ( e ) = write ! ( io stdout ( ) " \n " r ) { if e . kind ( ) != io :: ErrorKind :: BrokenPipe { panic ! ( e ) ; } } } Ok ( ( ) ) }
This will ignore broken pipes, to support unix piping into things like head
This will ignore broken pipes to support unix piping into things like head
conn
&Connection
word
&str
all
bool
conn
&Connection
word
&str
all
bool