Closed crescentrose closed 3 months ago
The Default
implementation is needed to create the handler (hello::<MyService>::default()
), but using #[derive(Default)]` is not ideal.
https://github.com/poem-web/poem/pull/848 fixes this.
@thinety this is great, thank you for picking this up!
Description of the feature
The
#[handler]
macro currently adds aDebug
derive to every endpoint that it generates. This causes some issues when working with handlers that take generic arguments.In some situations, e.g. services with shared database connections, a
Default
implementation is not appropriate or even possible. Based on some cursory testing, it seems like thedefault()
method doesn't even get called. But it is very much possible that I missed something, so please let me know if aDefault
implementation is necessary.To avoid a breaking change, perhaps the
Default
derive could only be omitted with an optional parameter to thehandler
macro?Code example (if possible)