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: pvrecorder.rs
    path of file: ./repos/jarvis/app/src/recorder
    
    the code of the file until where you have to start completion: use once_cell::sync::OnceCell;
use std::sync::atomic::{AtomicBool, Ordering};
use pv_recorder::{Recorder, RecorderBuilder};

static RECORDER: OnceCell<Recorder> = OnceCell::new();
static IS_RECORDING: AtomicBool = AtomicBool::new(false);

pub fn init_microphone(device_index: i32, frame_length: u32) -> bool {
    match RECORDER.get().is_none() {
        true => {
            let pv_recorder = RecorderBuilder::new()
          
    
pub fn init_microphone(device_index: i32, frame_length: u32) -> bool {
    match RECORDER.get().is_none() {
        true => {
            let pv_recorder = RecorderBuilder::new()
                .device_index(device_index)
                .frame_length(frame_length as i32)
                .init();

            match pv_recorder {
                Ok(pv) => {
                    // store
                    RECORDER.set(pv);

                    // success
                    true
                },
                Err(msg) => {
                    error!("Failed to initialize pvrecorder.\nError details: {:?}", msg);

                    // fail
                    false
                }
            }
        },
        _ => true // already initialized
    }
}