-
Notifications
You must be signed in to change notification settings - Fork 19
Add docs for Vector, Point and Matrix types #35
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
Conversation
kvark
left a comment
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.
Thank you for the PR!
No major concerns, just a few questions.
src/matrix.rs
Outdated
| $( #[doc = $doc:expr] )* | ||
| $name:ident: $major_ty:ident $vec:ident[ $($field:ident = $index:expr),* ] = ($inner:expr, $outer:expr) | ||
| ) => { | ||
| decl_matrix_type! { |
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.
is there a point for a separate macro here if it's not used elsewhere?
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.
So, documentation generation for types declared in macros requires you to use the doc attribute, which is quite unwieldy.
The attribute itself can only take either a string literal, or a $expr fragment as its single argument, which means that:
- you either have to construct the doc comment line by line using a sequence of
#[doc = "blah"]#[doc = $string_expr]statements for interpolation, or: - you can do the interpolation using
concat!andstringify!, and then pass that off to another macro (example taken from here), à la a c-style stringification macro.
I wish it were easier as well, but I think this is the simplest way I could find.
src/vector.rs
Outdated
| #[doc = "Constructs a `"] | ||
| #[doc = $sname] | ||
| #[doc = "` from the first "] | ||
| #[doc = $dim] |
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 that's quite strange. Is there a way to do string interpolation here?
src/vector.rs
Outdated
| $(#[doc = $doc:expr])* | ||
| $name:ident ($dim:expr) [ $($field:ident = $index:expr),* ] = $fixed:ty | ||
| ) => { | ||
| decl_vector_type! { |
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.
same question here - why do we need a separate macro?
|
Can you please rebase on top of master instead of going with the merge commit? |
Happy to bikeshed exactly what the docs should say