I want to implement a ThreadPool struct which can take any function (with different type and no. of arguments) and execute it in a new thread. I have written a sample code below where I need to pass s1_method() and s2_method() to execute() function of ThreadPool. Is there any way to achieve this in rust? Any help on this will be appreciated.
struct s1 {
}
struct s2{
}
impl s1 {
fn s1_method(&self, var1 : u32, var2 : bool){
}
}
impl s2 {
fn s2_method(&self, var3 : String){
}
}
struct ThreadPool{
fn execute(){
}
}