pub fn to_toml_str(toml_str: impl Serialize) -> MutexGuard<'static, String>
Expand description

to_toml_str used to convert struct to toml string

 use serde_derive::Serialize;
 #[derive(Serialize)]
 struct Human {
     name: String,
     age: u8,
     country: Country,
 }
 #[derive(Serialize)]
 struct Country {
     name: String,
 }
 let user = Human {
     name: "mike".to_string(),
     age: 18,
     country: Country {
         name: "country_name".to_string(),
     },
 };
 let toml = tsu::to_toml_str(&user);
 println!("{}",toml.as_str());