Tee implementation without Clone requirement#744
Draft
frankmcsherry wants to merge 9 commits intoTimelyDataflow:masterfrom
Draft
Tee implementation without Clone requirement#744frankmcsherry wants to merge 9 commits intoTimelyDataflow:masterfrom
Tee implementation without Clone requirement#744frankmcsherry wants to merge 9 commits intoTimelyDataflow:masterfrom
Conversation
20bad58 to
4610fec
Compare
802a3bd to
6a90ff1
Compare
frankmcsherry
commented
Feb 21, 2026
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.
This is a bit of a proof of concept, stealing a bit from @antiguru's PR.
The goal is to support a
Teethat does not have an inherentClonerequirement. Currently, the requirement exists becauseTeeitself is responsible for cloning containers when there are multiple consumers, and we need to haveTeeto support any number of consumers.The change here is to use a
Box<dyn Push<T>>for theTee, whose implementor either is or is not able to clone pushed containers, and handles that call without constrainingTee. The two implementors,PushOneandPushMany, respectively do not and do requireClone. The logic is set up so that theTeeHelperinstalls aPushManyonly as the second pushee, and doing so could in principle live behind a method that has theC: Cloneconstraint.It's not certain how to proceed, other than stealing further from @antiguru. Any concrete
TeeHelperorStreamCorewould need to either requireCloneor not, and the ability to use it would depend on how we set that up. It seems "easy" to have two distinct types, but @antiguru reports that perhaps this is not necessary (theStreamliketrait not being required). Further investigation / copying is required!