I am trying to return an error Result with &'static str .
impl Worker { fn get_task_by_name(&self, name: String) -> Result<Box<Task>, &'static str> { Err("Task not found!"); } }
It produces the following error:
src/lib.rs:84:5: 84:8 error: unable to infer enough type information about `_`; type annotations or generic parameter binding required [E0282] src/lib.rs:84 Err("Task not found!"); ^~~
What could be the problem?
Endel source share