softprops / afterparty

rust github webhook server
MIT License
55 stars 13 forks source link

Porting to hyper 0.11 series #27

Closed 19h closed 6 years ago

19h commented 7 years ago

Hey @softprops,

I ported afterparty to hyper 0.11 (and the hyper-related semantics seem to work), but the 'static lifetimes used for the hooks are causing troubles.

New hyper service: https://github.com/psychonautwiki/afterparty/blob/master/src/lib.rs#L129-L199

I've done most of the heavy lifting, maybe you could look into a smart way to fix this?

Error output: https://gist.github.com/KenanSulayman/89ea6158df1589540e1f28db5df99379

Cheers,

-- Kenan

🐝

softprops commented 7 years ago

Very cool! I probably wont get a chance to take a closer look until this weekend though.

softprops commented 7 years ago

just glacing though.. note: ...so that the type futures::Map<...> will meet its required lifetime bounds that makes me think the refs to hooks may need to be cloned

Not sure this is possible atm without some extra #[derive(Clone)] but I think if it were possible you'd want do do something like

                    if let Some(hooks) = self.hooks(event) {
                       let these_hooks = hooks.clone();

Then reference these_hooks from inside your future.map operation below

I can take a closer look this weekend.

19h commented 7 years ago

I assume you didn't have a look at it :) I'll check and maybe I'll find a way

drahnr commented 6 years ago

@softprops @KenanSulayman any progress on this?

softprops commented 6 years ago

Not as of yet but it is planned. I'm currently going through a number of my crates and doing the upgrade. This is on my list