This is a golang equivalent of my code in rust.
Please suggest what changes to make.This is the error I'm getting
Compiling playground v0.0.1 (/playground)
error[E0277]: the trait bound AccountInfoRecord: serde::ser::Serialize
is not satisfied
use chrono::prelude::*;
struct AccountInfoRecord {
page_name: String,
policy_id: String,
updated_time: String,
page_mode: String, // ReadOnly, Editable
element: Elements,
}
struct Elements {
salutation: String,
first_name: String,
last_name: String,
middle_name: String,
full_name: String,
primary_addr: Primary,
}
struct Primary {
addr1: String,
addr2: String,
city: String,
state: String,
zip: String,
county: String,
country: String,
}
fn main() {
println!("Hello, world!");
let mut rec = AccountInfoRecord {
page_name: String::from("Account_UI"),
policy_id: String::from("1"),
updated_time: Utc::now().format("%a, %d %b %Y %H:%M:%S GMT").to_string(),
page_mode: String::new(), // Initialize as needed
element: Elements {
salutation: String::from("Salutation"), // Replace with actual value
first_name: String::from("FirstName"), // Replace with actual value
last_name: String::from("LastName"), // Replace with actual value
middle_name: String::from("MiddleName"), // Replace with actual value
full_name: String::from("FullName"), // Replace with actual value
primary_addr: Primary {
addr1: String::from("MailAddr1"), // Replace with actual value
addr2: String::from("MailAddr2"), // Replace with actual value
city: String::from("MailCity"), // Replace with actual value
state: String::from("MailState"), // Replace with actual value
zip: String::from("MailZip"), // Replace with actual value
county: String::from("MailCounty"), // Replace with actual value
country: String::from("MailCountry"), // Replace with actual value
},
},
};
let rec_mar = serde_json::to_string_pretty(&rec).unwrap();
println!("{}", rec_mar);
}