INNER CODE UNIT · Rust

load

vmware-labs/wasm-workers-server · crates/config/src/lib.rs:43

    pub fn load(project_root: &Path) -> Result<Self> {
        let config_path = Self::config_path(project_root);

        if config_path.exists() {
            Ok(toml::from_str(&fs::read_to_string(config_path)?)?)
        } else {
            Ok(Self::default())
        }
    }

    /// Save a new installed runtime
    pub fn save_runtime(&mut self, repo_name: &str, repo_url: &str, runtime: &Runtime) {
        let repo = self.repositories.iter_mut().find(|r| r.name == repo_name);

        // Shadow to init an empty one if required
        match repo {
            Some(r) => r.runtimes.push(runtime.clone()),
            None => {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…