[Solved] Create the type of Box


I think this may help you.

#[derive(Debug)]
enum Fruit {
    Apple(String),
    Banana(String),
}

#[derive(Debug)]
struct Test {
    A: Box<Fruit>,
}

fn main() {
    let test = Test {
        A: Box::new(Fruit::Apple("apple".to_string())),
    };
    println!("{:?}", test)
}

1

solved Create the type of Box