-
Notifications
You must be signed in to change notification settings - Fork 98
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 documentation options for extension!() #232
Conversation
fix: fix op_format_file_name op reference (#230)
Merge changes
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.
Thanks for this PR! I think this will be very useful. Let's tweak the comments a bit to make them.
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
core/extensions.rs
Outdated
/// Initialize this extension for use with CommonJS | ||
/// For modules, use init_ops_and_esm instead | ||
/// | ||
/// # Returns | ||
/// an Extension object that can be used during instantiation of a JsRuntime | ||
pub fn init_js_only $( < $( $param : $type + 'static ),* > )? () -> $crate::Extension |
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.
I think we should leave this one undocumented, or even mark it as deprecated. We don't use it in CLI or anywhere I know of. And I don't know when you'd use it. It might be a legacy thing. It seems to just not execute the state fn and middleware.
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.
/// Legacy function for extension instantiation.
/// Please use `init_ops_and_esm` or `init_ops` instead
///
/// # Returns
/// an Extension object that can be used during instantiation of a JsRuntime
#[deprecated(since="0.216.0", note="please use `init_ops_and_esm` or `init_ops` instead")]
Added deprecation notice, and altered documentation to reflect the change
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
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.
LGTM
Added
docs: comma separated list of toplevel #[doc=...] tags to be applied to the extension's resulting struct
to extension! to allow users to set docblocks for it, since the struct is always made publicAdded comments for generated functions, since they break linting when warning about missing function docs
Added an op2 example that uses the change (also it is difficult to find samples of op2 and extension! in use with the runtime - having access to such an example would have simplified my usage of the crate significantly