trait C {}
struct A {}
impl C for A {}
struct B {}
impl C for B {}
fn create(value: u8) -> impl C {
match value {
0 => A {},
1 => B {},
_ => A {},
}
}
fn create(value: u8) -> Box<dyn C> {
match value {
0 => Box::new(A {}),
1 => Box::new(B {}),
_ => Box::new(A {}),
}
}