We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
as per the title.
To my surprise, this fails:
use serde::{self, Deserialize, Serialize}; #[derive(Deserialize, Debug, Serialize)] struct Config { store: StoreKind, } #[derive(Deserialize, Debug, Serialize)] enum StoreKind { File(FileConfig), Other, } #[derive(Deserialize, Debug, Serialize)] struct FileConfig { path: String, } fn main() { let cfg = Config { store: StoreKind::File(FileConfig { path: "path/to/thing".into(), }), }; let repr = basic_toml::to_string(&cfg).unwrap(); println!("{repr}"); }
The text was updated successfully, but these errors were encountered:
Deserialization does not work either. I have a configuration type like this:
#[derive(Debug, serde::Deserialize)] enum Listen { Address(String), Unix(String), } fn main() { let conf = r#" Address = "localhost" "#; dbg!(basic_toml::from_str::<Listen>(conf)); dbg!(toml::from_str::<Listen>(conf)); }
It gives:
[src/main.rs:11:5] basic_toml::from_str::<Listen>(conf) = Err( Error { kind: Custom, line: Some( 0, ), col: 0, at: Some( 0, ), message: "invalid type: map, expected enum Listen", key: [], }, ) [src/main.rs:12:5] toml::from_str::<Listen>(conf) = Ok( Address( "localhost", ), )
Sorry, something went wrong.
Split out socket config and switch back to toml crate
toml
c5263c6
basic-toml does not support externally-tagged enum yet. See: dtolnay/basic-toml#8
No branches or pull requests
as per the title.
To my surprise, this fails:
The text was updated successfully, but these errors were encountered: