thruster-rs / Thruster

A fast, middleware based, web framework written in Rust
MIT License
1.06k stars 47 forks source link

middleware tuple compile errors #192

Closed rts-gordon closed 3 years ago

rts-gordon commented 3 years ago

Hi @trezm I compile the lastest code from master branch, there are some errors, can you please have a look at those:

error[E0599]: the method `middleware` exists for tuple `(fn(T, Box<(dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send + 'static)>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>, fn(T, Box<(dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send + 'static)>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>, fn(T, Box<(dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send + 'static)>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>, fn(T, Box<(dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send + 'static)>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>, fn(T, Box<(dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send + 'static)>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>)`, but its trait bounds were not satisfied
   --> thruster\src\parser\middleware_traits.rs:125:1
    |
125 | generate_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ method cannot be called on `(fn(T, Box<(dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send + 'static)>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>, fn(T, Box<(dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send + 'static)>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>, fn(T, Box<(dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send + 'static)>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>, fn(T, Box<(dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + 
Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send + 'static)>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>, fn(T, Box<(dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send + 'static)>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>)` due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `fn(T, Box<dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send>) 
-> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>: MiddlewareFunc<_>`
            which is required by `(fn(T, Box<dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync 
+ std::marker::Send>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>, fn(T, Box<dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>, fn(T, Box<dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send 
+ 'static)>> + Sync + std::marker::Send>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>, fn(T, Box<dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>, fn(T, Box<dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync 
+ std::marker::Send + 'static)>> + Sync + std::marker::Send>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>): middleware_traits::IntoMiddleware<_, (fn(T, Box<dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>, fn(T, Box<dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>, fn(T, Box<dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>, fn(T, Box<dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>, fn(T, Box<dyn FnOnce(T) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>> + Sync + std::marker::Send>) -> Pin<Box<(dyn futures::Future<Output = Result<T, ThrusterError<T>>> + Sync + std::marker::Send + 'static)>>)>` 
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
trezm commented 3 years ago

A few things need to be updated, the working branch is here: https://github.com/thruster-rs/Thruster/pull/193. I just need to clean up some of the alternative servers before I can merge it in.

trezm commented 3 years ago

This should be resolved by https://github.com/thruster-rs/Thruster/releases/tag/v1.1.9! Let me know if you're still having issues.