Add from_senders for the Sync Client#779
Conversation
swanandx
left a comment
There was a problem hiding this comment.
Thanks for the PR and your patience!
Can you please add the same changes for v5/client as well? so we can stay consistent!
|
Yeah absolutely! |
|
any updates @BKDaugherty ? |
The `from_senders` method used to take a pair of channels, but now it only takes one. Let's update the doc comment.
The `AsyncClient` has a `from_senders` method that can be used to create a Fake client for dependency injection. Let's surface a similar method for the sync client
dbdd540 to
530da3f
Compare
Hey! Sorry @swanandx, I was AFK a bit for the holidays. Just updated to add this to the v5 client as well! Is there a proposal at all for unifying these? Would be curious to see that |
|
Hm. Any idea why the macos tests would fail? Doesn't seem related to this |
Oh no worries, Thank you so much!
I was thinking about it, but then how would be distinguish between v4 & v5 clients? we might need to store a field like
i don't have that idea either haha, it keeps failing randomly. so we can ignore it |
A lot of my team's code uses the synchronous client. I'd like to be able to easily write tests using a Fake Mqtt client. One easy way to do this for unit tests is by using something like the
from_sendersmethod that's available on theAsyncClient. This PR adds afrom_sendermethod for the sync client which can be used to write tests like the one I wrote in this PR.It also updates a stale comment on the async client.
Type of change
New feature (non-breaking change which adds functionality)
Checklist:
cargo fmtCHANGELOG.mdif it's relevant to the users of the library. If it's not relevant mention why.