feat(ros-z): simplify backend by removing ZMessage wrapper boilerplate#320
Open
YuanYuYuan wants to merge 2 commits intoRosLibRust:masterfrom
Open
feat(ros-z): simplify backend by removing ZMessage wrapper boilerplate#320YuanYuYuan wants to merge 2 commits intoRosLibRust:masterfrom
YuanYuYuan wants to merge 2 commits intoRosLibRust:masterfrom
Conversation
…erSerdes Replace the wrapper boilerplate required by the old ZMessage::Serdes associated type with direct use of SerdeCdrSerdes via the new ZSerdes<T> builder API introduced in ZettaScaleLabs/ros-z dev/serdes-param. - Remove RosMessageWrapper<T> and WrapperSerdes<T> - ZenohPublisher<T> wraps ZPub<T, SerdeCdrSerdes> directly - ZenohSubscriber<T> wraps ZSub<T, Sample, SerdeCdrSerdes> directly - advertise/subscribe use create_pub_impl/create_sub_impl + .with_serdes() - Fake<T> retained for orphan-rule ZService shim (services only)
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.
Summary
Simplifies the ros-z backend in
roslibrust_ros2by removing wrapper boilerplate that was required to work aroundZMessage::Serdes. With theZSerdes<T>refactor in ZettaScaleLabs/ros-z#131, message types can now specify their wire format at the call site, soT: RosMessageTypecan be used directly without needing an intermediate wrapper type.Key Changes
RosMessageWrapper<T>— the newtype wrapper that existed solely to satisfyZMessage::Serdesis no longer neededWrapperSerdes<T>— the customZSerializer/ZDeserializerimpl delegating toCdrSerdes<T>is replaced byCdrCompatSerdesdirectlyZenohPublisher<T>now wrapsZPub<T, CdrCompatSerdes>instead ofZPub<RosMessageWrapper<T>, WrapperSerdes<T>>ZenohSubscriber<T>now wrapsZSub<T, Sample, CdrCompatSerdes>—recv()returnsTdirectly, no.0unwrapadvertise/subscribeusenode.create_pub_impl/create_sub_implwith.with_serdes::<CdrCompatSerdes>()and type info built fromT::ROS2_TYPE_NAME/T::ROS2_HASHFake<T>retained for services — the orphan rule still preventsimpl ZService for T: RosServiceTypein a downstream crate; the shim is kept but now only handles type routing, not serialization logicBreaking Changes
None for downstream users of
roslibrust_ros2— the public API (TopicProvider,ServiceProviderimpls onZenohClient) is unchanged.