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: player_event_handler.rs
    path of file: ./repos/librespot/src
    
    the code of the file until where you have to start completion: use log::{debug, error, warn};

use std::{collections::HashMap, process::Command, thread};

use librespot::{
    metadata::audio::UniqueFields,
    playback::player::{PlayerEvent, PlayerEventChannel, SinkStatus},
};

pub struct EventHandler {
    thread_handle: Option<thread::JoinHandle<()>>,
}

impl EventHandler {
    pub fn new(mut player_events: PlayerEventChannel, onevent: &str) -> Self {
        let on_event = onevent.to_string();
        let thread_handle = Some(thread::spawn(move || loop {
            match player_events.blocking_recv() {
                None => break,
                Some(event) => {
                    let mut env_vars = HashMap::new();

                    match event {
                        PlayerEvent::PlayRequestIdChanged { play_request_id } => {
                            env_vars.insert("PLAYER_EVENT", "play_request_id_
    
fn run_program(env_vars: HashMap<&str, String>, onevent: &str) {
    let mut v: Vec<&str> = onevent.split_whitespace().collect();

    debug!(
        "Running {} with environment variables:\n{:#?}",
        onevent, env_vars
    );

    match Command::new(v.remove(0))
        .args(&v)
        .envs(env_vars.iter())
        .spawn()
    {
        Err(e) => warn!("On event program {} failed to start: {}", onevent, e),
        Ok(mut child) => match child.wait() {
            Err(e) => warn!("On event program {} failed: {}", onevent, e),
            Ok(e) if e.success() => (),
            Ok(e) => {
                if let Some(code) = e.code() {
                    warn!("On event program {} returned exit code {}", onevent, code);
                } else {
                    warn!("On event program {} returned failure: {}", onevent, e);
                }
            }
        },
    }
}