Replies: 2 comments
-
I get your point, however I really do not feel ok about exposing internals, as we might want to refactor them at some point in time. if you prefer |
Beta Was this translation helpful? Give feedback.
0 replies
-
@barafael btw if async closures will stabilize this year as it was hinted, we could have a really nice improvement here. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think the event callback is not optimal for my usecase. I am creating an
async_nats::Client
, then passing it to a tokio task. This task wants to receiveasync_nats::Event
s.Right now I do this by creating a struct with some state first, then extract an
mpsc::Sender
from it (it owns thempsc::Receiver
). Then create the client (giving thempsc::Sender
to theConnectOptions::event_callback
). Then, I spawn the future on a tokio task.Would it be possible to gain access to a
watch::Receiver<async_nats::Event>
bound to the internal watch channel somehow? It is not possible afaik to use a watch channel in theevent_callback
because that one requires async move and awatch::Sender
is notClone
. To be fair, it is possible to put it in an arc, first...Beta Was this translation helpful? Give feedback.
All reactions