refactor(workspace): prefer native async fn in traits over BoxFuture - #698
Open
varex83agent wants to merge 1 commit into
Open
refactor(workspace): prefer native async fn in traits over BoxFuture#698varex83agent wants to merge 1 commit into
varex83agent wants to merge 1 commit into
Conversation
Traits that are never used as `dyn` now use native async-fn-in-trait (spelled `-> impl Future + Send` where generic callers need to spawn the returned future); `#[async_trait]` is reserved for the traits that are genuinely held as `dyn`. Deletes the boxed-future trait methods that only wrapped already-async inherent methods and drops core's duplicate `BoxFuture` alias in favour of `futures::future::BoxFuture`. libp2p `ConnectionHandler` state-machine `BoxFuture`s and the subscriber callback type aliases (#606) are left untouched. Closes #613. Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #613.
Traits that are never used as
dynnow use native async-fn-in-trait, spelled-> impl Future + Sendwhere generic callers need theSendbound to spawn the returned future.#[async_trait]is kept only on the traits genuinely held asdyn(consensus::wrapper::Consensus,dkg::bcast::RegisteredMessage), each with a doc comment recording why.Deletes the boxed-future trait methods that merely wrapped already-async inherent methods, unboxes
priority'ssend_receive, and dropscore's duplicateBoxFuturealias in favour offutures::future::BoxFuture.Out of scope and untouched: the libp2p
ConnectionHandlerstate-machineBoxFutures, and the subscriber callback type aliases owned by #606.Co-Authored-By: Bohdan Ohorodnii 35969035+varex83@users.noreply.github.com