pub async fn build(mut self) -> Result<FontService, Error> {
        let manifests: Result<Vec<(FontManifestWrapper, Option<PathBuf>)>, Error> = self
            .manifests
            .drain(..)
            .map(|manifest_or_path| match manifest_or_path {
                ManifestOrPath::Manifest(manifest) => Ok((manifest, None)),
                ManifestOrPath::Path(path) => {
                    fx_vlog!(1, "Loading manifest {:?}", &path);
                    Ok((FontsManifest::load_from_file(&path)?, Some(path)))
                }
            })
            .collect();

        for (wrapper, path) in manifests? {
            match wrapper {
                FontManifestWrapper::Version1(v1) => {
                    self.add_fonts_from_manifest_v1(v1, path).await?
                }
                FontManifestWrapper::Version2(v2) => {
                    self.add_fonts_from_manifest_v2(v2, path).await?
                }
            }
        }

        // It's fine to have no fallback collection IFF we loaded an empty manifest.
        if self.fallback_collection.is_empty() && !self.families.is_empty() {
            return Err(FontServiceBuilderError::NoFallbackCollection.into());
        }

        Ok(FontService {
            assets: self.assets.build(),
            families: self.families,
            fallback_collection: self.fallback_collection,
        })
    }
/// Tries to build a [`FontService`] from the provided manifests, with some additional error checking.
Tries to build a [`FontService`] from the provided manifests, with some additional error checking.
Tries to build a [ ` FontService ` ] from the provided manifests with some additional error checking .
pub async fn build(mut self) -> Result<FontService, Error> {
        let manifests: Result<Vec<(FontManifestWrapper, Option<PathBuf>)>, Error> = self
            .manifests
            .drain(..)
            .map(|manifest_or_path| match manifest_or_path {
                ManifestOrPath::Manifest(manifest) => Ok((manifest, None)),
                ManifestOrPath::Path(path) => {
                    fx_vlog!(1, "Loading manifest {:?}", &path);
                    Ok((FontsManifest::load_from_file(&path)?, Some(path)))
                }
            })
            .collect();
        for (wrapper, path) in manifests? {
            match wrapper {
                FontManifestWrapper::Version1(v1) => {
                    self.add_fonts_from_manifest_v1(v1, path).await?
                }
                FontManifestWrapper::Version2(v2) => {
                    self.add_fonts_from_manifest_v2(v2, path).await?
                }
            }
        }
        // It's fine to have no fallback collection IFF we loaded an empty manifest.
        if self.fallback_collection.is_empty() && !self.families.is_empty() {
            return Err(FontServiceBuilderError::NoFallbackCollection.into());
        }
        Ok(FontService {
            assets: self.assets.build(),
            families: self.families,
            fallback_collection: self.fallback_collection,
        })
    }
pub async fn build ( mut self ) -> Result < FontService , Error > { let manifests : Result < Vec < ( FontManifestWrapper , Option < PathBuf > ) > , Error > = self . manifests . drain ( .. ) . map ( | manifest_or_path | match manifest_or_path { ManifestOrPath :: Manifest ( manifest ) => Ok ( ( manifest , None ) ) , ManifestOrPath :: Path ( path ) => { fx_vlog ! ( 1 " " path ) ; Ok ( ( FontsManifest :: load_from_file ( & path ) ? , Some ( path ) ) ) } } ) . collect ( ) ; for ( wrapper , path ) in manifests ? { match wrapper { FontManifestWrapper :: Version1 ( v1 ) => { self . add_fonts_from_manifest_v1 ( v1 , path ) . await ? } FontManifestWrapper :: Version2 ( v2 ) => { self . add_fonts_from_manifest_v2 ( v2 , path ) . await ? } } } // It's fine to have no fallback collection IFF we loaded an empty manifest. if self . fallback_collection . is_empty ( ) && ! self . families . is_empty ( ) { return Err ( FontServiceBuilderError :: NoFallbackCollection . into ( ) ) ; } Ok ( FontService { assets : self . assets . build ( ) , families : self . families , fallback_collection : self . fallback_collection , } ) }
Tries to build a [`FontService`] from the provided manifests, with some additional error checking.
Tries to build a [ ` FontService ` ] from the provided manifests with some additional error checking .
mut self
mut self