Random stuff, testing things, and so on.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 lines
573 B

use serde_derive::Deserialize;
use serde_derive::Serialize;
trait Marker {}
#[derive(Serialize, Deserialize, Debug)]
struct AsString {
value: String,
}
impl Marker for AsString {}
#[derive(Serialize, Deserialize, Debug)]
struct AsU8 {
value: u8,
}
impl Marker for AsU8 {}
fn main() {
let mut contents: Vec<Box<dyn Marker>> = Vec::new();
contents.push(Box::new(AsString {
value: "Some value".into(),
}));
contents.push(Box::new(AsU8 { value: 2 }));
let convered = toml::to_string(&contents).unwrap();
println!("{}", convered);
}