Function oneio::read_json_struct

source ·
pub fn read_json_struct<T: DeserializeOwned>(
    path: &str
) -> Result<T, OneIoError>
Expand description

Reads a JSON file and deserializes it into the specified struct.

§Arguments

  • path - A string slice representing the path to the JSON file.

§Generic Parameters

  • T - The type of struct to deserialize the JSON into. It must implement the DeserializeOwned trait from the serde crate.

§Returns

Returns a Result containing the deserialized struct if successful, or an OneIoError if there was an error reading the file or deserializing the JSON