-
Notifications
You must be signed in to change notification settings - Fork 52
Refactor functions on how they return metadata #1028
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
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.
Pull Request Overview
This PR refactors the function implementation approach by consolidating function metadata into a single FunctionMetadata
struct and improving argument validation logic. The refactor enhances type safety and introduces more granular argument type checking.
- Replaces individual trait methods with a unified
get_metadata()
method returningFunctionMetadata
- Transitions from
AcceptedArgKind
toFunctionArgKind
with enhanced type information - Implements ordered argument type validation and support for remaining arguments with different type constraints
Reviewed Changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
dsc_lib/src/functions/mod.rs | Core refactor implementing FunctionMetadata struct and enhanced argument validation logic |
dsc_lib/src/functions/*.rs | Function implementations updated to use new metadata structure |
dsc/src/subcommand.rs | Function listing updated to use new metadata approach |
dsc_lib/locales/en-us.toml | Added localization strings for new error messages |
dsc/locales/en-us.toml | Updated table header for return types display |
I wonder if it is worth further abstracting some of the input arg validation for functions like |
If there is sufficient functions that have same pattern, then I would say yes, but if it's more of a one-off, I'd leave it to the individual function to validate. Many of the comparison functions have similar pattern where both have to be string or number, but I think the rust code doesn't change so it doesn't seem to be saving anything if pre-check. |
PR Summary
Refactor how functions are implemented so that: