I'm declaring a function which has a parameter of type [impl Tr;2]
, but I don't known how to construct an argument of this type. ln the following code , line A does not work. Please give me some tips. thanks in advance.
fn main() {
trait Tr {
fn test(&self) {}
}
struct U;
struct V;
impl Tr for U {}
impl Tr for V {}
//let x = [U,V]; // A
fn test(x:[impl Tr;2]) {
for x in x {
x.test();
}
}
}