wamp_async
wamp_async copied to clipboard
Workaround for lifetime poisoning with client?
I am looking into implementing call canceling. My first idea to minimize the impact of the changes was to spawn a task for the client to wait for call results, and return a cancelable future from Client::call
that would abort the task (if required based on options) and send the WAMP CANCEL
message using the Client. This doesn't appear to be possible because of the lifetime poisoning that occurs as described in the commit message from #5.
Anyone have another idea how this could be implemented. The main issue is that you need the call request_id
to cancel the call, but in the current implementation of Client::call
you wouldn't have the request_id
until receiving the result.
The only thing I can think is that Client::call
only returns a struct with the request_id
, and an implementation which would allow you to get the results
future, or execute cancel
from there.