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

Allow an optional context when using dive #143

Merged
merged 2 commits into from
Jan 19, 2025

Conversation

lasantosr
Copy link
Contributor

@lasantosr lasantosr commented Jan 19, 2025

This PR closes #142

The macro is backwards-compatible, so it just requires a minor version update.

Copy link
Owner

@jprochazk jprochazk left a comment

Choose a reason for hiding this comment

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

Overall seems good to me, just one question about syntax.

min: usize,
#[garde(skip)]
max: usize,
#[garde(dive(&(self.min, self.max)))]
Copy link
Owner

Choose a reason for hiding this comment

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

This should probably not require the &, and instead always prefix the #ctx with & in emit, because context is always passed by reference. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That seems right! I've just updated the PR

@jprochazk
Copy link
Owner

Thanks!

@jprochazk jprochazk merged commit 395a85d into jprochazk:main Jan 19, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support changing context for dive
2 participants