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

fix(rust): handle destructured params case (#617) #618

Merged
merged 3 commits into from
Sep 10, 2023

Conversation

kkoomen
Copy link
Owner

@kkoomen kkoomen commented Sep 10, 2023

Fixes #617

@kkoomen kkoomen added the improvement A feature that can be improved in some way label Sep 10, 2023
@kkoomen kkoomen self-assigned this Sep 10, 2023
@RasmusRendal
Copy link

In some cases, it just seems to ignore arguments?

pub struct SorryForBeingMean {
    pub x: i8,
    pub y: i8,
}

pub fn some_function(SorryForBeingMean {x, y}: SorryForBeingMean) -> i8 {
    x * y
}
pub struct SorryForBeingMean (i8, i8);

pub fn some_function(SorryForBeingMean (x, y): SorryForBeingMean) -> i8 {
    x * y
}

You can do crazy things with these arguments, and I'm not even sure what the correct way to write rustdocs for these things are, so I totally understand if you don't want to support everything. For reference, this was the pattern I was trying to document: https://docs.rs/actix-web/latest/actix_web/web/struct.Form.html#examples

Thanks for the good work! ❤️

@kkoomen
Copy link
Owner Author

kkoomen commented Sep 10, 2023

Mhm, there doesn't seem to be anything specific indeed about how to write it. I'll just keep it like this for now and when rustdoc will be more mature, I'll just receive some PRs about this at some point in time :)

@kkoomen kkoomen merged commit 39dc181 into master Sep 10, 2023
13 checks passed
@kkoomen kkoomen deleted the feature/rust-destructured-params branch September 10, 2023 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement A feature that can be improved in some way
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rust: Function parameters as patterns causes panic in helper
2 participants