Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add send_async method to AgentLink so it's easier to work with futures #1210

Closed
stoically opened this issue May 12, 2020 · 4 comments
Closed
Labels
feature-request A feature request

Comments

@stoically
Copy link
Contributor

stoically commented May 12, 2020

Issuehunt badges

Is your feature request related to a problem? Please describe.
When having to call async functions inside of agent methods like update and handle_input an future closure is needed (with e.g. wasm-bindgen-futures)

Describe the solution you'd like
An convenience wrapper like send_async that takes an async closure and handles execution would be handy

Describe alternatives you've considered
Allowing some of the Agent trait methods to be async (with e.g. async-trait) might be an alternative but would come with added complexity to handle cases of lingering awaits

Additional context
The case where an send_async closure calls the AgentLink after it was dropped would cause a panic, so this might be something to be considered

Similarly send_future previously existed on components but was removed. Maybe an feature flag for such helper methods might be the right choice.

Related: #1209


IssueHunt Summary

Backers (Total: $0.00)

Become a backer now!

Or submit a pull request to get the deposits!

Tips

@stoically stoically added the feature-request A feature request label May 12, 2020
@issuehunt-oss
Copy link

issuehunt-oss bot commented May 12, 2020

@jstarry has funded $5.00 to this issue.


@issuehunt-oss issuehunt-oss bot added the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label May 12, 2020
@kellpossible
Copy link
Contributor

FYI we have send_future now for ComponentLink and AgentLink in the yewtil crate (https://github.com/yewstack/yew/blob/master/yewtil/src/future.rs#L62), does that cover this usecase?

@jstarry
Copy link
Member

jstarry commented Jul 5, 2020

Yeah, sounds good, thanks for pointing that out!

@jstarry jstarry closed this as completed Jul 5, 2020
@issuehunt-oss
Copy link

issuehunt-oss bot commented Jul 5, 2020

@jstarry has cancelled funding for this issue.(Cancelled amount: $5.00) See it on IssueHunt

@issuehunt-oss issuehunt-oss bot removed the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label Jul 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature request
Projects
None yet
Development

No branches or pull requests

3 participants