struct User {
id: i8,
name: &'static str
}
struct UserMethods {
add_user: Fn(User) -> (),
}
fn main() {
UserMethods {
add_user: |user| {
}
};
}
The compiler says,
error[E0277]: the size for values of type `(dyn Fn(User) + 'static)` cannot be known at compilation time
--> src/main.rs:11:5
|
11 | / UserMethods {
12 | | add_user: |user| {},
13 | | };
| |_____^ doesn't have a size known at compile-time