Skip to main content

read_json

Function read_json 

Source
pub fn read_json<T: DeserializeOwned>(
    path: &Path,
) -> Result<Option<T>, StoreError>
Expand description

Read and decode JSON from path.

Returns Ok(None) when the file does not exist. When the file exists but cannot be decoded, it is quarantined and StoreError::Corrupt is returned — the unreadable bytes are never silently discarded or overwritten. If the quarantine move itself fails, the error still reports the corruption (with quarantined: None) so the signal is never lost.