How to parse TOML

Parse TOML strings in Rust using the `toml` crate and `from_str` to convert text into usable data structures.

Use the toml crate to parse TOML strings into Rust structs or Value types.

use toml::from_str;

let toml_str = r#"
name = "example"
version = "0.1.0"
"#;

let config: Result<serde_json::Value, _> = from_str(toml_str);

Install the crate with cargo add toml and derive Deserialize on your struct if using a custom type.