fn save(
        dynamic_configs_path: &Path,
        dynamic_configs: &mut HashMap<RepoUrl, InspectableRepositoryConfig>,
    ) {
        let configs = dynamic_configs.iter().map(|(_, c)| (***c).clone()).collect::<Vec<_>>();

        let result = (|| {
            let mut temp_path = dynamic_configs_path.as_os_str().to_owned();
            temp_path.push(".new");
            let temp_path = PathBuf::from(temp_path);
            {
                let f = fs::File::create(&temp_path)?;
                serde_json::to_writer(
                    io::BufWriter::new(f),
                    &RepositoryConfigs::Version1(configs),
                )?;
            }
            fs::rename(temp_path, dynamic_configs_path)
        })();

        match result {
            Ok(()) => {}
            Err(err) => {
                fx_log_err!("error while saving repositories: {}", err);
            }
        }
    }
/// If persistent dynamic configs are enabled, save the current configs to disk. Log, and
/// ultimately ignore, any errors that occur to make sure forward progress can always be made.
If persistent dynamic configs are enabled, save the current configs to disk. Log, and
ultimately ignore, any errors that occur to make sure forward progress can always be made.
If persistent dynamic configs are enabled save the current configs to disk . Log and ultimately ignore any errors that occur to make sure forward progress can always be made .
fn save(
        dynamic_configs_path: &Path,
        dynamic_configs: &mut HashMap<RepoUrl, InspectableRepositoryConfig>,
    ) {
        let configs = dynamic_configs.iter().map(|(_, c)| (***c).clone()).collect::<Vec<_>>();
        let result = (|| {
            let mut temp_path = dynamic_configs_path.as_os_str().to_owned();
            temp_path.push(".new");
            let temp_path = PathBuf::from(temp_path);
            {
                let f = fs::File::create(&temp_path)?;
                serde_json::to_writer(
                    io::BufWriter::new(f),
                    &RepositoryConfigs::Version1(configs),
                )?;
            }
            fs::rename(temp_path, dynamic_configs_path)
        })();
        match result {
            Ok(()) => {}
            Err(err) => {
                fx_log_err!("error while saving repositories: {}", err);
            }
        }
    }
fn save ( dynamic_configs_path : & Path , dynamic_configs : & mut HashMap < RepoUrl , InspectableRepositoryConfig > , ) { let configs = dynamic_configs . iter ( ) . map ( | ( _ , c ) | ( * * * c ) . clone ( ) ) . collect :: < Vec < _ > > ( ) ; let result = ( | | { let mut temp_path = dynamic_configs_path . as_os_str ( ) . to_owned ( ) ; temp_path . push ( " " ) ; let temp_path = PathBuf :: from ( temp_path ) ; { let f = fs :: File :: create ( & temp_path ) ? ; serde_json :: to_writer ( io :: BufWriter :: new ( f ) , & RepositoryConfigs :: Version1 ( configs ) , ) ? ; } fs :: rename ( temp_path , dynamic_configs_path ) } ) ( ) ; match result { Ok ( ( ) ) => { } Err ( err ) => { fx_log_err ! ( " " err ) ; } } }
If persistent dynamic configs are enabled, save the current configs to disk.
If persistent dynamic configs are enabled save the current configs to disk .
dynamic_configs_path
&Path
dynamic_configs
&mut HashMap<RepoUrl, InspectableRepositoryConfig>