pub async fn find(
        &self,
        problem_name: &str,
    ) -> anyhow::Result<Option<(pom::Problem, PathBuf)>> {
        let mut cache = self.cache.lock().await;
        if let Some(cached_info) = cache.items.get(problem_name) {
            return Ok(Some((
                cached_info.manifest.clone(),
                cached_info.assets.clone(),
            )));
        }
        // cache for this problem not found, let's load it.
        let assets_path = self.cache_dir.join(problem_name);
        for registry in &self.registries {
            if let Some(manifest) = registry
                .get_problem(problem_name, &assets_path)
                .await
                .with_context(|| {
                    format!(
                        "failed to search for problem {} in registry {}",
                        problem_name,
                        registry.name()
                    )
                })?
            {
                cache.items.insert(
                    problem_name.to_string(),
                    ProblemCacheItem {
                        manifest: manifest.clone(),
                        assets: assets_path.clone(),
                    },
                );
                return Ok(Some((manifest, assets_path)));
            }
        }
        // no registry knows about this problem
        Ok(None)
    }
/// Tries to resolve problem named `problem_name` in all configured
/// registries. On success, returns problem manifest to path to assets dir.
Tries to resolve problem named `problem_name` in all configured
registries. On success, returns problem manifest to path to assets dir.
Tries to resolve problem named ` problem_name ` in all configured registries . On success returns problem manifest to path to assets dir .
pub async fn find(
        &self,
        problem_name: &str,
    ) -> anyhow::Result<Option<(pom::Problem, PathBuf)>> {
        let mut cache = self.cache.lock().await;
        if let Some(cached_info) = cache.items.get(problem_name) {
            return Ok(Some((
                cached_info.manifest.clone(),
                cached_info.assets.clone(),
            )));
        }
        // cache for this problem not found, let's load it.
        let assets_path = self.cache_dir.join(problem_name);
        for registry in &self.registries {
            if let Some(manifest) = registry
                .get_problem(problem_name, &assets_path)
                .await
                .with_context(|| {
                    format!(
                        "failed to search for problem {} in registry {}",
                        problem_name,
                        registry.name()
                    )
                })?
            {
                cache.items.insert(
                    problem_name.to_string(),
                    ProblemCacheItem {
                        manifest: manifest.clone(),
                        assets: assets_path.clone(),
                    },
                );
                return Ok(Some((manifest, assets_path)));
            }
        }
        // no registry knows about this problem
        Ok(None)
    }
pub async fn find ( & self , problem_name : & str , ) -> anyhow :: Result < Option < ( pom :: Problem , PathBuf ) > > { let mut cache = self . cache . lock ( ) . await ; if let Some ( cached_info ) = cache . items . get ( problem_name ) { return Ok ( Some ( ( cached_info . manifest . clone ( ) , cached_info . assets . clone ( ) , ) ) ) ; } // cache for this problem not found, let's load it. let assets_path = self . cache_dir . join ( problem_name ) ; for registry in & self . registries { if let Some ( manifest ) = registry . get_problem ( problem_name , & assets_path ) . await . with_context ( | | { format ! ( " " problem_name registry name ( ) ) } ) ? { cache . items . insert ( problem_name . to_string ( ) , ProblemCacheItem { manifest : manifest . clone ( ) , assets : assets_path . clone ( ) , } , ) ; return Ok ( Some ( ( manifest , assets_path ) ) ) ; } } // no registry knows about this problem Ok ( None ) }
Tries to resolve problem named `problem_name` in all configured
registries.
Tries to resolve problem named ` problem_name ` in all configured registries .
&self
problem_name
&str