Skip to content
New issue

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

toml不能直接转换的原因可能是只能存储key-value形式的 #6

Open
Bear-V opened this issue Jun 20, 2024 · 0 comments
Open

Comments

@Bear-V
Copy link

Bear-V commented Jun 20, 2024

OutputFormat::Toml => {
            // toml 只能以 key-value 的形式存储数据
            let mut obj = HashMap::new();
            obj.insert("data", ret);
            toml::to_string_pretty(&obj)?
        }

我改成这样就可以的运行了
出来数据是这样的

[[data]]
DOB = "Dec 10, 1987 (31)"
"Kit Number" = "21"
Name = "Gonzalo Higuaín"
Nationality = "Argentina"
Position = "Centre-Forward"

[[data]]
DOB = "May 21, 1986 (33)"
"Kit Number" = "17"
Name = "Mario Mandzukic"
Nationality = "Croatia"
Position = "Centre-Forward"

不知道老师有没有更好的办法
或者说
toml确实只能存储key-value形式的文本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant