Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Publisher::get_subscription_count #457

Merged

Conversation

romainreignier
Copy link
Contributor

This should close #456

This is my first contribution to ros2_rust and I am not sure about the return code handling and safety comment.
Any feedback is welcomed.

rclrs/src/publisher.rs Outdated Show resolved Hide resolved
@romainreignier romainreignier force-pushed the feature/add_get_subscription_count branch from ba8e6ac to e76157f Compare February 4, 2025 00:55
@romainreignier romainreignier requested a review from jhdcs February 4, 2025 01:05
@jhdcs
Copy link
Collaborator

jhdcs commented Feb 4, 2025

Looking good so far! I did think of one other thing that should probably be added. In the bottom of the file, there is a test_publishers unit test. Would you be able to add a test for your code to it? Since there aren't any subscribers created in the test, we should expect a count of 0, but this is good practice to include anyways.

Sorry for the extra task there, wish I had thought of it before...

@romainreignier romainreignier force-pushed the feature/add_get_subscription_count branch from e76157f to 11128b9 Compare February 4, 2025 17:40
@romainreignier
Copy link
Contributor Author

Thanks for the suggestion, I have added the tests.

@romainreignier romainreignier force-pushed the feature/add_get_subscription_count branch from 11128b9 to 3e04892 Compare February 4, 2025 17:50
@romainreignier
Copy link
Contributor Author

Sorry, I had missed a publisher to test. I have tried to add a to each topic and it works as well.

@romainreignier romainreignier force-pushed the feature/add_get_subscription_count branch from 3e04892 to 5e162f2 Compare February 4, 2025 17:51
@jhdcs
Copy link
Collaborator

jhdcs commented Feb 4, 2025

Confirmed that this works on my setup. Thank you very much for your contribution!

@jhdcs jhdcs merged commit 94f76e5 into ros2-rust:main Feb 4, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get_subscription_count() missing for Publisher
2 participants