JsonOperations

Trait JsonOperations 

Source
pub trait JsonOperations {
    // Provided methods
    fn read_json_with_context<T: DeserializeOwned>(
        path: impl AsRef<Path>,
    ) -> Result<T> { ... }
    fn write_json_with_context<T: Serialize>(
        value: &T,
        path: impl AsRef<Path>,
    ) -> Result<()> { ... }
}
Expand description

Common JSON operations with consistent error handling

Provided Methods§

Source

fn read_json_with_context<T: DeserializeOwned>( path: impl AsRef<Path>, ) -> Result<T>

Read and parse a JSON file with appropriate error context

Source

fn write_json_with_context<T: Serialize>( value: &T, path: impl AsRef<Path>, ) -> Result<()>

Serialize and write a JSON file with appropriate error context

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§