You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wait until the matching reply is received, then return that reply (much more complicated)
Tasks
For number 2 to be possible, there generally needs to be some way to have a send function call lay 'dormant' until it is notified. This requires some way to refer to the 'task' for the function call. The downside here is that, as far as I can tell, doing that requires a dependency on one specific async runtime.
Alternatives to a direct runtime dependency
I will have to explore this area further because I don't have enough knowledge to answer this, but perhaps there is a way that notifying the task - and the idea of the task itself - can be left up to the end user. That is, that only the API is included in X.RS when it comes to that in particular. If possible, it would make sense to me that by default X.RS has an async runtime dependency on tokio, but that this is controlled by a feature flag which may be opt out of, allowing for the use of other async runtimes.
Other challenges
I do wonder about the difficulties which come with whether the send function would require mutating self (where self is the struct representing the client/the connection), and whether that would present difficulties when it comes to async code and sending multiple requests before their replies are received.
There is certain code which must be done sequentially when sending requests: quite obviously, incrementing the sequence number, which is literally the number associated with the sequential order of sending requests. But if you had to make entire send function calls sequential and wait for their replies before sending a new request, well, that would ruin the entire point of making this async at all.
These are other challenges that will need addressing, and I do hope they are solvable.
help wantedExtra attention is neededquestionFurther information is requested
1 participant
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Ideally, the API for sending a request would look something like this pseudocode:
For this to work, the function would have to:
Tasks
For number 2 to be possible, there generally needs to be some way to have a
send
function call lay 'dormant' until it is notified. This requires some way to refer to the 'task' for the function call. The downside here is that, as far as I can tell, doing that requires a dependency on one specific async runtime.Alternatives to a direct runtime dependency
I will have to explore this area further because I don't have enough knowledge to answer this, but perhaps there is a way that notifying the task - and the idea of the task itself - can be left up to the end user. That is, that only the API is included in X.RS when it comes to that in particular. If possible, it would make sense to me that by default X.RS has an async runtime dependency on
tokio
, but that this is controlled by a feature flag which may be opt out of, allowing for the use of other async runtimes.Other challenges
I do wonder about the difficulties which come with whether the
send
function would require mutatingself
(whereself
is the struct representing the client/the connection), and whether that would present difficulties when it comes to async code and sending multiple requests before their replies are received.There is certain code which must be done sequentially when sending requests: quite obviously, incrementing the sequence number, which is literally the number associated with the sequential order of sending requests. But if you had to make entire
send
function calls sequential and wait for their replies before sending a new request, well, that would ruin the entire point of making this async at all.These are other challenges that will need addressing, and I do hope they are solvable.
Beta Was this translation helpful? Give feedback.
All reactions