Skip to main content

load_state

Function load_state 

Source
pub fn load_state<T: DeserializeOwned + Default>(path: &Path) -> Result<T>
Expand description

Load state from a JSON file.

  • If the file does not exist, returns the type’s Default value.
  • If the file exists but cannot be parsed, returns an error.

§Errors

Returns io::Error if the file exists but cannot be read or parsed.