lunatic-solutions/lunatic-rs

Support generics and `where` clauses in `#[abstract_process]` macro

tqwewe opened this issue · 2 comments

If the #[abstract_process] macro is used on an impl with any generics or where clauses, it fails.

It might be nice to support this, though it may be a little complicated.

struct GenericProcess<T>(T);

#[abstract_process]
impl<T> GenericProcess<T>
where
    T: Clone
{ ... }

Should expand to:

impl<T> lunatic::process::AbstractProcess for GenericProcess<T>
where
    T: Clone
{ ... }

impl<T> GenericProcessHandler for lunatic::process::ProcessRef<GenericProcess<T>>
where
    T: Clone
{ ... }

// ...

Yes, we should definitely support that. I skipped it in the first iteration because I just wanted to get the feature out and test it on some sample applications, but I think it is time to work on supporting generics now. I can try to get a PR in probably tonight or tomorrow after adding support for send_after and request_timeout.

Closed by #53