Conflict implementation in trait 'Factory'

Viewed 92
fn home(name:String) -> String {
  name
}

fn index() -> String {
  "Hello".to_string()
}

trait Factory {}

impl<T> Factory for T where T: Fn() -> String {

}

impl<T> Factory for T where T: Fn(String) -> String {

}

struct User {}

impl User {
  fn get<F>(factory: F) where F: Factory {

  }
}
fn main() {
  User::get(index);
  User::get(home);
}

Hey guys I am having this issue wherein rust compiler complains about trait implementation conflicts. The issue occurs when i write this piece of code "impl Factory for T where T: Fn(String) -> String". Please help. Any suggestions to resolve this issue will help.

0 Answers
Related