fn find_or_decode(
        &self,
        key: &str,
    ) -> Result<Arc<DecoderImpl::Output>, AssetCacheError<DecoderImpl::Error>> {
        if let Some(x) = self.search_for_item(key) {
            return Ok(x);
        }

        // Stop any other threads from trying to decode this item, and make them wait on this thread to finish.
        let mutex = {
            let mut guard_inner = self.decoding_guards.lock().unwrap();
            let tmp = guard_inner
                .entry(key.to_string())
                .or_insert_with(|| Arc::new(Mutex::new(())));
            (*tmp).clone()
        };
        // The type here is important: it makes sure that we actually lock the mutex, by making this variable definitely
        // be a guard.  Any mistakes in the above rather complicated chain to set this up will be caught at compile
        // time.
        let _guard: std::sync::MutexGuard<()> = mutex.lock().unwrap();

        self.find_or_decode_postchecked(key)
    }
/// Find or decode an item from the cache.
Find or decode an item from the cache.
Find or decode an item from the cache .
fn find_or_decode(
        &self,
        key: &str,
    ) -> Result<Arc<DecoderImpl::Output>, AssetCacheError<DecoderImpl::Error>> {
        if let Some(x) = self.search_for_item(key) {
            return Ok(x);
        }
        // Stop any other threads from trying to decode this item, and make them wait on this thread to finish.
        let mutex = {
            let mut guard_inner = self.decoding_guards.lock().unwrap();
            let tmp = guard_inner
                .entry(key.to_string())
                .or_insert_with(|| Arc::new(Mutex::new(())));
            (*tmp).clone()
        };
        // The type here is important: it makes sure that we actually lock the mutex, by making this variable definitely
        // be a guard.  Any mistakes in the above rather complicated chain to set this up will be caught at compile
        // time.
        let _guard: std::sync::MutexGuard<()> = mutex.lock().unwrap();
        self.find_or_decode_postchecked(key)
    }
fn find_or_decode ( & self , key : & str , ) -> Result < Arc < DecoderImpl :: Output > , AssetCacheError < DecoderImpl :: Error > > { if let Some ( x ) = self . search_for_item ( key ) { return Ok ( x ) ; } // Stop any other threads from trying to decode this item, and make them wait on this thread to finish. let mutex = { let mut guard_inner = self . decoding_guards . lock ( ) . unwrap ( ) ; let tmp = guard_inner . entry ( key . to_string ( ) ) . or_insert_with ( | | Arc :: new ( Mutex :: new ( ( ) ) ) ) ; ( * tmp ) . clone ( ) } ; // The type here is important: it makes sure that we actually lock the mutex, by making this variable definitely // be a guard.  Any mistakes in the above rather complicated chain to set this up will be caught at compile // time. let _guard : std :: sync :: MutexGuard < ( ) > = mutex . lock ( ) . unwrap ( ) ; self . find_or_decode_postchecked ( key ) }
Find or decode an item from the cache.
Find or decode an item from the cache .
&self
key
&str
&self
key
&str