Skip to content

Add new node name-related functions #143

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

Merged
merged 1 commit into from
May 2, 2022
Merged

Add new node name-related functions #143

merged 1 commit into from
May 2, 2022

Conversation

nnmm
Copy link
Contributor

@nnmm nnmm commented May 1, 2022

  • Add Node::name, Node::namespace, Node::fully_qualified_name getters
  • Add Context::create_node_with_namespace function
  • Swap order of namespace and name argument in Node::new_with_namespace, so that it's less confusing

- Add Node::name, Node::namespace, Node::fully_qualified_name getters
- Add Context::create_node_with_namespace function
- Swap order of namespace and name argument in Node::new_with_namespace, so that it's less confusing
@nnmm nnmm requested review from esteve and jhdcs and removed request for esteve May 1, 2022 12:28
self.get_string(rcl_node_get_fully_qualified_name)
}

fn get_string(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a good candidate for a macro, IMHO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't care much either way in this instance, but the approach using a function could be said to have a few advantages:

  • Less code size (obviously doesn't matter much for such a small function)
  • No need to know macro_rules!
  • Better IDE support
  • You can see the type of the function supported by the helper
  • Definition of the helper is closer to the call site (since macro would typically be at the top level)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little less efficient though, but I think for these functions that won't matter.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that makes sense. I was just thinking of #141 and how to integrate it with this, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's something we'll need to think about. Maybe call_ffi!(getter, …) will already work if the right token type is used.

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.

2 participants