pub fn new(
    input: impl Into<EmbeddedAssetsInput>,
    map: impl Fn(&AssetKey, &Path, &mut Vec<u8>, &mut CspHashes) -> Result<(), EmbeddedAssetsError>,
  ) -> Result<Self, EmbeddedAssetsError> {
    // we need to pre-compute all files now, so that we can inject data from all files into a few
    let RawEmbeddedAssets { paths, csp_hashes } = RawEmbeddedAssets::new(input.into())?;

    struct CompressState {
      csp_hashes: CspHashes,
      assets: HashMap<AssetKey, (PathBuf, PathBuf)>,
    }

    let CompressState { assets, csp_hashes } = paths.into_iter().try_fold(
      CompressState {
        csp_hashes,
        assets: HashMap::new(),
      },
      move |mut state, (prefix, entry)| {
        let (key, asset) = Self::compress_file(&prefix, entry.path(), &map, &mut state.csp_hashes)?;
        state.assets.insert(key, asset);
        Ok(state)
      },
    )?;

    Ok(Self { assets, csp_hashes })
  }
/// Compress a collection of files and directories, ready to be generated into [`Assets`].
///
/// [`Assets`]: tauri_utils::assets::Assets
Compress a collection of files and directories, ready to be generated into [`Assets`].
Compress a collection of files and directories ready to be generated into [ ` Assets ` ] .
pub fn new(
    input: impl Into<EmbeddedAssetsInput>,
    map: impl Fn(&AssetKey, &Path, &mut Vec<u8>, &mut CspHashes) -> Result<(), EmbeddedAssetsError>,
  ) -> Result<Self, EmbeddedAssetsError> {
    // we need to pre-compute all files now, so that we can inject data from all files into a few
    let RawEmbeddedAssets { paths, csp_hashes } = RawEmbeddedAssets::new(input.into())?;
    struct CompressState {
      csp_hashes: CspHashes,
      assets: HashMap<AssetKey, (PathBuf, PathBuf)>,
    }
    let CompressState { assets, csp_hashes } = paths.into_iter().try_fold(
      CompressState {
        csp_hashes,
        assets: HashMap::new(),
      },
      move |mut state, (prefix, entry)| {
        let (key, asset) = Self::compress_file(&prefix, entry.path(), &map, &mut state.csp_hashes)?;
        state.assets.insert(key, asset);
        Ok(state)
      },
    )?;
    Ok(Self { assets, csp_hashes })
  }
pub fn new ( input : impl Into < EmbeddedAssetsInput > , map : impl Fn ( & AssetKey , & Path , & mut Vec < u8 > , & mut CspHashes ) -> Result < ( ) , EmbeddedAssetsError > , ) -> Result < Self , EmbeddedAssetsError > { // we need to pre-compute all files now, so that we can inject data from all files into a few let RawEmbeddedAssets { paths , csp_hashes } = RawEmbeddedAssets :: new ( input . into ( ) ) ? ; struct CompressState { csp_hashes : CspHashes , assets : HashMap < AssetKey , ( PathBuf , PathBuf ) > , } let CompressState { assets , csp_hashes } = paths . into_iter ( ) . try_fold ( CompressState { csp_hashes , assets : HashMap :: new ( ) , } , move | mut state , ( prefix , entry ) | { let ( key , asset ) = Self :: compress_file ( & prefix , entry . path ( ) , & map , & mut state . csp_hashes ) ? ; state . assets . insert ( key , asset ) ; Ok ( state ) } , ) ? ; Ok ( Self { assets , csp_hashes } ) }
Compress a collection of files and directories, ready to be generated into [`Assets`].
Compress a collection of files and directories ready to be generated into [ ` Assets ` ] .
input
impl Into<EmbeddedAssetsInput>
map
impl Fn(&AssetKey, &Path, &mut Vec<u8>, &mut CspHashes) -> Result<(), EmbeddedAssetsError>
input
impl Into<EmbeddedAssetsInput>
map
impl Fn(&AssetKey, &Path, &mut Vec<u8>, &mut CspHashes) -> Result<(), EmbeddedAssetsError>