/// Deserialize a value using a JSON if this is a debug build, and CBOR otherwise.
Deserialize a value using a JSON if this is a debug build, and CBOR otherwise.
Deserialize a value using a JSON if this is a debug build and CBOR otherwise .
pub fn deserialize<T: DeserializeOwned>(path: &Path) -> Result<T> {
    let file = File::open(path).into_diagnostic()?;
    let reader = BufReader::new(file);
    if cfg!(debug_assertions) {
        serde_json::from_reader(reader).into_diagnostic()
    } else {
        ciborium::de::from_reader(reader).into_diagnostic()
    }
}
pub fn deserialize < T : DeserializeOwned > ( path : & Path ) -> Result < T > { let file = File :: open ( path ) . into_diagnostic ( ) ? ; let reader = BufReader :: new ( file ) ; if cfg ! ( debug_assertions ) { serde_json :: from_reader ( reader ) . into_diagnostic ( ) } else { ciborium :: de :: from_reader ( reader ) . into_diagnostic ( ) } }
Deserialize a value using a JSON if this is a debug build, and CBOR otherwise.
Deserialize a value using a JSON if this is a debug build and CBOR otherwise .
path
&Path