fn maybe_write_binary<T: Serialize>(path: &str, obj: &T) -> Result<()>