You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: key.rs
    path of file: ./repos/enigo/tests/common
    
    the code of the file until where you have to start completion: use std::sync::mpsc::Receiver;

use enigo::{
    Direction::{Press, Release},
    Enigo, Key, Keyboard, Settings,
};

use super::BrowserEvent;

pub fn r
    
fn press(recv: &Receiver<BrowserEvent>, key: Key) {
    let mut enigo = Enigo::new(&Settings::default()).unwrap();

    enigo.key(key, Press).unwrap();
    let ev = recv
        .recv_timeout(std::time::Duration::from_millis(5000))
        .unwrap();
    if let BrowserEvent::KeyDown(pressed) = ev {
        assert_eq!(format!("{key:?}").to_lowercase(), pressed.to_lowercase());
    } else {
        panic!("Event wasn't KeyDown after mouse::press. {ev:?}");
    }
    enigo.key(key, Release).unwrap();
    let ev = recv
        .recv_timeout(std::time::Duration::from_millis(5000))
        .unwrap();
    if let BrowserEvent::KeyUp(pressed) = ev {
        assert_eq!(format!("{key:?}").to_lowercase(), pressed.to_lowercase());
    } else {
        panic!("Event wasn't KeyUp after mouse::press. {ev:?}");
    }
}