-
Notifications
You must be signed in to change notification settings - Fork 73
Support no-Clone generated services created by custom MakeService impls #152
Comments
A side note: it feels weird that one type can implement different parameterizations of |
The generated To your point about parameterization: the request type used to be an associated type, but there's some reasons it was changed to a generic:
If you think about |
The |
It's not very common to see explicit implementations of I understand the case for polymorphism on conceptually similar inputs, as also demonstrated by the generated server struct implementing |
I do think it'd be a good idea to generate a In order to completely remove |
As currently emitted by the server generator, the service trait requires
Clone
and the server object implements theService<()>
impl to satisfyMakeService
by cloning itself. While simple, this precludes implementations where the service factory provides instances with call-specific data, such as synchronization objects or connection-level attributes. While it may be possible to use the extension map of the HTTPRequest
(once that is made available on the gRPC request), this is an unnecessarily dynamic approach with performance drawbacks.It would be nice to have a build flag that removes the
Clone
requirement and the self-replicatingMakeService
impl, leaving the application to provide the service factory as appropriate.This could help with #67 and may facilitate #2.
The text was updated successfully, but these errors were encountered: