Hi folks,
I'm getting a little confused with this error message I'm getting.
❯ make dev
cargo run --example axum
Compiling inngest v0.0.1 (/home/darwin/workspace/inngest-rs)
error[E0631]: type mismatch in closure arguments
--> examples/axum/main.rs:73:9
|
73 | Box::new(|_input: Input<&DummyEvent>| {
| ^ ---------------------------- found signature defined here
| _________|
| |
74 | | println!("In dummy function");
75 | |
76 | | Ok(Box::new("test result".to_string()))
77 | | }),
| |__________^ expected due to this
|
= note: expected closure signature `for<'a> fn(Input<&'a (dyn inngest::event::Event + 'a)>) -> _`
found closure signature `for<'a> fn(Input<&'a DummyEvent>) -> _`
= note: required for the cast from `Box<[closure@examples/axum/main.rs:73:18: 73:46]>` to `Box<(dyn for<'a> Fn(Input<&'a (dyn inngest::event::Event + 'a)>) -> Result<Box<(dyn Any + 'static)>, std::string::String> + Send + Sync + 'static)>`
For more information about this error, try `rustc --explain E0631`.
error: could not compile `inngest` (example "axum") due to previous error
make: *** [Makefile:3: dev] Error 101
Where it's saying that it's not getting the expected Event
trait argument.
However, DummyEvent
here actually does implement the Event
trait argument, so I'm not sure what I'm missing here.
I tried changing from using a closure to a function pointer instead to make sure it's actually an argument signature issue, and it happens on function pointers too.
❯ make dev
cargo run --example axum
Compiling inngest v0.0.1 (/home/darwin/workspace/inngest-rs)
error[E0308]: mismatched types
--> examples/axum/main.rs:73:9
|
64 | create_function(
| --------------- arguments to this function are incorrect
...
73 | handle_dummy,
| ^^^^^^^^^^^^ expected fn pointer, found fn item
|
= note: expected fn pointer `for<'a> fn(Input<&'a (dyn inngest::event::Event + 'a)>) -> Result<_, _>`
found fn item `for<'a> fn(Input<&'a DummyEvent>) -> Result<_, _> {handle_dummy}`
= note: when the arguments and return types match, functions can be coerced to function pointers
note: function defined here
--> /home/darwin/workspace/inngest-rs/src/function.rs:118:8
|
118 | pub fn create_function(
| ^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0308`.
error: could not compile `inngest` (example "axum") due to previous error
make: *** [Makefile:3: dev] Error 101
It's rather tricky to provide just a minimum codebase to show case the issue, because it'll pretty much end up with the whole code base anyways, so you can just use this branch of the repo if you like to see the context behind it.
Running make dev
should give you the error I'm seeing.