From 8035fb285c0cdf7a5788d9ee028b75ad56884494 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Fri, 2 Jul 2021 11:06:09 -0600 Subject: [PATCH] fix toml --- appmgr/src/util.rs | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/appmgr/src/util.rs b/appmgr/src/util.rs index e94731aee..cf1341abf 100644 --- a/appmgr/src/util.rs +++ b/appmgr/src/util.rs @@ -674,13 +674,22 @@ impl IoFormat { serde_cbor::to_writer(writer, value).with_kind(crate::ErrorKind::Serialization) } IoFormat::Toml => writer - .write_all(&serde_toml::to_vec(value).with_kind(crate::ErrorKind::Serialization)?) + .write_all( + &serde_toml::to_vec( + &serde_toml::Value::try_from(value) + .with_kind(crate::ErrorKind::Serialization)?, + ) + .with_kind(crate::ErrorKind::Serialization)?, + ) .with_kind(crate::ErrorKind::Serialization), IoFormat::TomlPretty => writer .write_all( - serde_toml::to_string_pretty(value) - .with_kind(crate::ErrorKind::Serialization)? - .as_bytes(), + serde_toml::to_string_pretty( + &serde_toml::Value::try_from(value) + .with_kind(crate::ErrorKind::Serialization)?, + ) + .with_kind(crate::ErrorKind::Serialization)? + .as_bytes(), ) .with_kind(crate::ErrorKind::Serialization), } @@ -693,10 +702,15 @@ impl IoFormat { } IoFormat::Yaml => serde_yaml::to_vec(value).with_kind(crate::ErrorKind::Serialization), IoFormat::Cbor => serde_cbor::to_vec(value).with_kind(crate::ErrorKind::Serialization), - IoFormat::Toml => serde_toml::to_vec(value).with_kind(crate::ErrorKind::Serialization), - IoFormat::TomlPretty => serde_toml::to_string_pretty(value) - .map(|s| s.into_bytes()) - .with_kind(crate::ErrorKind::Serialization), + IoFormat::Toml => serde_toml::to_vec( + &serde_toml::Value::try_from(value).with_kind(crate::ErrorKind::Serialization)?, + ) + .with_kind(crate::ErrorKind::Serialization), + IoFormat::TomlPretty => serde_toml::to_string_pretty( + &serde_toml::Value::try_from(value).with_kind(crate::ErrorKind::Serialization)?, + ) + .map(|s| s.into_bytes()) + .with_kind(crate::ErrorKind::Serialization), } } /// BLOCKING