Skip to content

Type mismatch error while trying to compile examples/simple.rs #4

@ngirard

Description

@ngirard

Got the following error while trying to compile:

cargo run --example simple
error[E0631]: type mismatch in function arguments
  --> examples/simple.rs:14:36
   |
14 |     ItemList::new(rustofi_entries, Box::new(simple_callback)).display("Select an entry".to_string())
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^ expected signature of `for<'r> fn(&'r mut std::string::String) -> _`
...
17 | pub fn simple_callback(s: &String) -> RustofiResult {
   | --------------------------------------------------- found signature of `for<'r> fn(&'r std::string::String) -> _`
   |
   = note: required because of the requirements on the impl of `rustofi::RustofiCallback<std::string::String>` for `for<'r> fn(&'r std::string::String) -> rustofi::RustofiResult {simple_callback}`
   = note: required for the cast to the object type `dyn for<'r> rustofi::RustofiCallback<std::string::String, Output = std::result::Result<(), std::string::String>>`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions