Skip to content

Instantly share code, notes, and snippets.

@jimluo
Created October 25, 2022 02:58
Show Gist options
  • Select an option

  • Save jimluo/8bd9f15777b716af1894cd6e73afc3f3 to your computer and use it in GitHub Desktop.

Select an option

Save jimluo/8bd9f15777b716af1894cd6e73afc3f3 to your computer and use it in GitHub Desktop.
genesis deserialize, use "DeserializeOwned"
fn read_config_file<T: de::DeserializeOwned>(filename: &str) -> Result<T> {
let f = fs::read_to_string(filename)?;
toml::from_str(&f)?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment