-
Notifications
You must be signed in to change notification settings - Fork 782
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
Proc macro documentation #1585
Proc macro documentation #1585
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, this is amazing. I hope this would improve experiences for new contributors.
I figured out that docs for #pyclass and #pymethods don't get rendered if the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 it's so nice to have this documentation! Thank you for taking the time to write it 💯
I have just a few questions, suggestions and tweaks...
/// | `weakref` | Allows this class to be [weakly referenceable][6]. | | ||
/// | `extends = BaseType` | Use a custom baseclass. Defaults to [`PyAny`][4] | | ||
/// | `subclass` | Allows Python classes to inherit from this class. | | ||
/// | `unsendable`<!-- hack to stop the column from wrapping -->                                 | Required if your struct is not [`Send`][3]. Rather than using `unsendable`, consider implementing your struct in a threadsafe way by e.g. substituting [`Rc`][8] with [`Arc`][9]. By using `unsendable`, your class will panic when accessed by another thread.| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain how this hack works? 🧠
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're whitespaces that do not permit wrapping.
If something tries minimizing the table column, "ham spam eggs" can wrap around their spaces, but "ham spam eggs" (ham spam eggs
) will not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, understood.
I think it's slightly more intuitive (although admittedly more ugly) to do something like
<span style="white-space: pre">`name = "python_name"`</span>
on the rows that we don't want to wrap, but I'll do that in a separate PR.
👍 thanks again for this, it's brilliant. |
Adds documentation for the proc macros.
It's mostly meant as a quick reference, as well as a future place to add doc aliases (they are not very discoverable right now).
Rendered