fn insert_batch(db: &mut Database, schema: &Schema, pws: &mut Vec<Password>) {
    let mut tx = db.begin();
    let mut tmps = Temporaries::new();

    for pw in pws.drain(..) {
        let eid = tx.create_entity();
        let cid = tmps.push_bytes(Box::new(pw.sha1));
        tx.assert(eid, schema.pw_sha1, Value::from_const_bytes(cid));
        tx.assert(eid, schema.pw_count, Value::from_u64_inline(pw.count));
    }

    db.commit(&tmps, tx).expect("TODO: Good Result types.");
}
/// Insert all passwords into the database. Leaves `pws` empty.
Insert all passwords into the database. Leaves `pws` empty.
Insert all passwords into the database . Leaves ` pws ` empty .
fn insert_batch(db: &mut Database, schema: &Schema, pws: &mut Vec<Password>) {
    let mut tx = db.begin();
    let mut tmps = Temporaries::new();
    for pw in pws.drain(..) {
        let eid = tx.create_entity();
        let cid = tmps.push_bytes(Box::new(pw.sha1));
        tx.assert(eid, schema.pw_sha1, Value::from_const_bytes(cid));
        tx.assert(eid, schema.pw_count, Value::from_u64_inline(pw.count));
    }
    db.commit(&tmps, tx).expect("TODO: Good Result types.");
}
fn insert_batch ( db : & mut Database , schema : & Schema , pws : & mut Vec < Password > ) { let mut tx = db . begin ( ) ; let mut tmps = Temporaries :: new ( ) ; for pw in pws . drain ( .. ) { let eid = tx . create_entity ( ) ; let cid = tmps . push_bytes ( Box :: new ( pw . sha1 ) ) ; tx . assert ( eid , schema . pw_sha1 , Value :: from_const_bytes ( cid ) ) ; tx . assert ( eid , schema . pw_count , Value :: from_u64_inline ( pw . count ) ) ; } db . commit ( & tmps , tx ) . expect ( " " ) ; }
Insert all passwords into the database.
Insert all passwords into the database .
db
&mut Database
schema
&Schema
pws
&mut Vec<Password>
db
&mut Database
schema
&Schema
pws
&mut Vec<Password>