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: ws2812_spi_light_on_beat.rs
    path of file: ./repos/beat-detector/examples
    
    the code of the file until where you have to start completion: /*
MIT License

Copyright (c) 2021 Philipp Schuster

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE
    
fn main() {
    println!("make sure you have \"SPI\" on your Pi enabled and that MOSI-Pin is connected with DIN-Pin!");
    let mut adapter = WS28xxSpiAdapter::new("/dev/spidev0.0").unwrap();

    let num_leds = select_num_leds();
    let anim = MovingLightStripsAnimation::new(num_leds as usize);
    let anim = Arc::new(Mutex::new(anim));

    let recording = Arc::new(AtomicBool::new(true));
    let recording_cpy = recording.clone();
    ctrlc::set_handler(move || {
        eprintln!("Stopping recording");
        recording_cpy.store(false, Ordering::SeqCst);
    })
    .expect("Ctrl-C handler doesn't work");

    let devs = beat_detector::record::audio_input_device_list();
    if devs.is_empty() {
        panic!("No audio input devices found!")
    }
    let dev = if devs.len() > 1 {
        select_input_device(devs)
    } else {
        devs.into_iter().next().unwrap().1
    };
    let strategy = select_strategy();
    let anim_t = anim.clone();
    let on_beat = move |info| {
        println!("Found beat at {:?}ms", info);
        anim_t.lock().unwrap().add_next_light_impulse();
    };
    let handle =
        beat_detector::record::start_listening(on_beat, Some(dev), strategy, recording.clone())
            .unwrap();

    while recording.load(Ordering::SeqCst) {
        let next_timestamp = Instant::now().add(Duration::from_millis(ANIMATION_FREQUENCY_MS));
        {
            // drop lock early
            let mut anim = anim.lock().unwrap();
            anim.shift_all_pixels();
            adapter.write_rgb(&anim.rgb_strip_vec_data).unwrap();
        }

        sleep_busy_waiting_until(next_timestamp);
    }

    handle.join().unwrap();
}