pub fn retrieve_messages(db_lock: Arc<Mutex<DB>>, identity: Identity) -> Vec<Message> {
    let db = db_lock.lock().unwrap();
    let mut message_list: Vec<Message> = Vec::new();
    for (key, value) in db.iterator(IteratorMode::Start) {
        if key[0..4] == identity.id {
            message_list.push(Decode::decode(&mut &(*value)).unwrap());
        }
    }
    message_list
}
/// Retrieve all messages for id. This is INCREDIBLY inefficient. We'll need to retool this.
Retrieve all messages for id. This is INCREDIBLY inefficient. We'll need to retool this.
Retrieve all messages for id . This is INCREDIBLY inefficient . We ' ll need to retool this .
pub fn retrieve_messages(db_lock: Arc<Mutex<DB>>, identity: Identity) -> Vec<Message> {
    let db = db_lock.lock().unwrap();
    let mut message_list: Vec<Message> = Vec::new();
    for (key, value) in db.iterator(IteratorMode::Start) {
        if key[0..4] == identity.id {
            message_list.push(Decode::decode(&mut &(*value)).unwrap());
        }
    }
    message_list
}
pub fn retrieve_messages ( db_lock : Arc < Mutex < DB > > , identity : Identity ) -> Vec < Message > { let db = db_lock . lock ( ) . unwrap ( ) ; let mut message_list : Vec < Message > = Vec :: new ( ) ; for ( key , value ) in db . iterator ( IteratorMode :: Start ) { if key [ 0 .. 4 ] == identity . id { message_list . push ( Decode :: decode ( & mut & ( * value ) ) . unwrap ( ) ) ; } } message_list }
Retrieve all messages for id.
Retrieve all messages for id .
db_lock
Arc<Mutex<DB>>
identity
Identity
db_lock
Arc<Mutex<DB>>
identity
Identity