Aligning with UTransport::register_listener() and UTransport::unregister_listener() with UListener (this time using generics)
#68
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.
Hey there 👋
Based on #65, I took my (second) shot at aligning our
UTransporttrait closer to the spec.In particular, I have removed the requirement for the implementation to explicitly manage listeners using
Stringidentifiers, instead leaning on concrete implementations of theUListenertrait.This change is to align with
registerListener()andunregisterListener()by bringing in aUListenertrait.As you read the code, you can see that there was a need for a new wrapper type called
ListenerWrapperaround UListener in order to allow us to disambiguate between concrete impls of it. The wrapper is also hashable to make it easy to use within containers that require that such asHashSetandHashMap. TheListenerWrapperneed only be used in theup-client-foo-rustimplementation. uEs just implUListener.Largely resolves the issues I had with the first attempt over in #67 thanks to that wrapper type.
Note: Over in a PR onto the
up-client-zenoh-rustrepo, I'm working on fleshing out how the changes will effect aup-client-foo-rustimplementation, to get a feel for if this is a reasonable approach. This is now out of date, see #69 for detailsI'm looking to see how this would impact current and future implementations of
UTransportfor UPClients. Feedback would be great from @AnotherDaniel, @sophokles73, @evshary in particular 🙂