pub fn load(&mut self) -> Result<()> {
        let info_path = get_metadata_path(&self.project_directory);

        if info_path.exists() {
            info!("Loading metadata from previous execution");
            let data =
                std::fs::read_to_string(&info_path).context("Failed to read RaukMetadata")?;
            let output_info: RaukMetadata = serde_json::from_str(&data).with_context(|| {
                format!("Failed to deserialize RaukMetadata with data: {:?}", &data)
            })?;
            if !output_info.previous_execution.gracefully_terminated {
                return Err(anyhow!("Previous execution of rauk did not terminate gracefully! Please manually restore your project's Cargo.toml by comparing it with the backup. Afterwards run `rauk cleanup`before proceeding!"));
            };

            self.project_directory = output_info.project_directory;
            self.rauk_output_directory = output_info.rauk_output_directory;
            self.previous_execution = output_info.previous_execution;
            self.artifacts = output_info.artifacts;
        }

        Ok(())
    }
/// Loads the output info file **if it exists** in the project path.
/// Will overwrite all values in the current struct!
Loads the output info file **if it exists** in the project path.
Will overwrite all values in the current struct!
Loads the output info file ** if it exists ** in the project path . Will overwrite all values in the current struct!
pub fn load(&mut self) -> Result<()> {
        let info_path = get_metadata_path(&self.project_directory);
        if info_path.exists() {
            info!("Loading metadata from previous execution");
            let data =
                std::fs::read_to_string(&info_path).context("Failed to read RaukMetadata")?;
            let output_info: RaukMetadata = serde_json::from_str(&data).with_context(|| {
                format!("Failed to deserialize RaukMetadata with data: {:?}", &data)
            })?;
            if !output_info.previous_execution.gracefully_terminated {
                return Err(anyhow!("Previous execution of rauk did not terminate gracefully! Please manually restore your project's Cargo.toml by comparing it with the backup. Afterwards run `rauk cleanup`before proceeding!"));
            };
            self.project_directory = output_info.project_directory;
            self.rauk_output_directory = output_info.rauk_output_directory;
            self.previous_execution = output_info.previous_execution;
            self.artifacts = output_info.artifacts;
        }
        Ok(())
    }
pub fn load ( & mut self ) -> Result < ( ) > { let info_path = get_metadata_path ( & self . project_directory ) ; if info_path . exists ( ) { info ! ( " " ) ; let data = std :: fs :: read_to_string ( & info_path ) . context ( " " ) ? ; let output_info : RaukMetadata = serde_json :: from_str ( & data ) . with_context ( | | { format ! ( " " data ) } ) ? ; if ! output_info . previous_execution . gracefully_terminated { return Err ( anyhow ! ( " " ) ) ; } ; self . project_directory = output_info . project_directory ; self . rauk_output_directory = output_info . rauk_output_directory ; self . previous_execution = output_info . previous_execution ; self . artifacts = output_info . artifacts ; } Ok ( ( ) ) }
Loads the output info file **if it exists** in the project path.
Loads the output info file ** if it exists ** in the project path .
&mut self
&mut self