fn ensure_future_audio_client(
        &self,
    ) -> Result<MutexGuard<Option<IAudioClientWrapper>>, IoError> {
        let mut lock = self.future_audio_client.lock().unwrap();
        if lock.is_some() {
            return Ok(lock);
        }

        let audio_client: *mut IAudioClient = unsafe {
            let mut audio_client = ptr::null_mut();
            let hresult = (*self.device).Activate(
                &IID_IAudioClient,
                CLSCTX_ALL,
                ptr::null_mut(),
                &mut audio_client,
            );

            // can fail if the device has been disconnected since we enumerated it, or if
            // the device doesn't support playback for some reason
            check_result(hresult)?;
            assert!(!audio_client.is_null());
            audio_client as *mut _
        };

        *lock = Some(IAudioClientWrapper(audio_client));
        Ok(lock)
    }
/// Ensures that `future_audio_client` contains a `Some` and returns a locked mutex to it.
Ensures that `future_audio_client` contains a `Some` and returns a locked mutex to it.
Ensures that ` future_audio_client ` contains a ` Some ` and returns a locked mutex to it .
fn ensure_future_audio_client(
        &self,
    ) -> Result<MutexGuard<Option<IAudioClientWrapper>>, IoError> {
        let mut lock = self.future_audio_client.lock().unwrap();
        if lock.is_some() {
            return Ok(lock);
        }
        let audio_client: *mut IAudioClient = unsafe {
            let mut audio_client = ptr::null_mut();
            let hresult = (*self.device).Activate(
                &IID_IAudioClient,
                CLSCTX_ALL,
                ptr::null_mut(),
                &mut audio_client,
            );
            // can fail if the device has been disconnected since we enumerated it, or if
            // the device doesn't support playback for some reason
            check_result(hresult)?;
            assert!(!audio_client.is_null());
            audio_client as *mut _
        };
        *lock = Some(IAudioClientWrapper(audio_client));
        Ok(lock)
    }
fn ensure_future_audio_client ( & self , ) -> Result < MutexGuard < Option < IAudioClientWrapper > > , IoError > { let mut lock = self . future_audio_client . lock ( ) . unwrap ( ) ; if lock . is_some ( ) { return Ok ( lock ) ; } let audio_client : * mut IAudioClient = unsafe { let mut audio_client = ptr :: null_mut ( ) ; let hresult = ( * self . device ) . Activate ( & IID_IAudioClient , CLSCTX_ALL , ptr :: null_mut ( ) , & mut audio_client , ) ; // can fail if the device has been disconnected since we enumerated it, or if // the device doesn't support playback for some reason check_result ( hresult ) ? ; assert ! ( audio_client is_null ( ) ) ; audio_client as * mut _ } ; * lock = Some ( IAudioClientWrapper ( audio_client ) ) ; Ok ( lock ) }
Ensures that `future_audio_client` contains a `Some` and returns a locked mutex to it.
Ensures that ` future_audio_client ` contains a ` Some ` and returns a locked mutex to it .
&self
&self