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

feat(core): implement Context::send in the builder-like manner #142

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nerodono
Copy link
Contributor

@nerodono nerodono commented Dec 8, 2024

Imperfect draft of turning Context::send into chained builder. Adding behavior settings for Context::send could be annoying, we already have functions like unbounded_send, send, send_to, unbounded_send_to, try_send, try_send_to and so on. With turning send into builder, we could achieve having only one function in the Context: Context::send, actions performed on that builder could be divided in two categories

Outcome

Function which finishes building of envelope and sends it, such as

  • ctx.send(..).try_() - try send without waiting for available place in the mailbox
  • ctx.send(..).unbounded() - send envelope unconditionally
  • ctx.send(..).await - wait for place in the destination mailbox and send

Parameters

  • .to(..) - destination

Moreover, we could elide request and request_to functions as well, but it requires more thought though, since ctx.send(..).resolve().await looks nice, but ctx.send(..).all().await seems confusing (Maybe unifying send and request interfaces is quite unfortunate?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant