drujensen
MModular
•Created by drujensen on 6/8/2024 in #questions
dynamic traits are not supported yet
Hello. Nooby question. I am working on some middleware for the lightbug project and want to build a chain-of-responsibility design pattern to handle the different aspects of processing a request / response:
This is how we would build the MiddlewareChain:
I'm getting the
TODO: Dynamic traits are not supported yet. please use a compile time generic instead.
I have tried using a
Pointer[Middleware]` but you need the type to cast and make the call. I also tried passing in a concrete middleware type as a parameter at compile time but it requires some really ugly code to chain them together.
Are there any other options? Let me know if anyone has a solution that doesn't look completely crazy.6 replies