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

cxx_name attribute - function aliases, import/export static methods, … #220

Closed
wants to merge 7 commits into from

Conversation

VKachemtsev
Copy link

I found a better solution for #218: cxx_side attribute
Features:

  • Renaming functions/methods in C++ and Rust
  • Import overloaded functions/methods
  • Export/import static methods from both sides

In the future we can add new features for this attribute: replace return type to UniquePtr/Box, implement constructors, etc.

Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

Thanks; I think the other approach is more promising to me though. I see that you noticed that #[cxx_side(name = "method", class = "C", static)] can be condensed to #[cxx_side(name = "C::method", static)]. But that's still a lot of redundancy because whether the method is a static member function or non-static member function is clear from whether it has a self: &C / self: &mut C first argument. And once you are down to #[cxx_side(name = "C::method")] that is just needless annoyance over the other style which was #[cxx_name = "C::method"].

@dtolnay dtolnay changed the title cxx_side attribute - function aliases, import/export static methods, … cxx_name attribute - function aliases, import/export static methods, … Jun 18, 2020
Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

Closing in favor of #218.

Thanks anyway!

@dtolnay dtolnay closed this Oct 10, 2020
@jon-chuang
Copy link

jon-chuang commented Jan 1, 2022

Hi, currently it is impossible to do #[cxx_name = "C::method"] for the static member function method of C. What is the workaround?

@jon-chuang
Copy link

I guess the workaround is to wrap in non-static function. Thanks!

Repository owner locked and limited conversation to collaborators Jan 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants