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

Use field access syntax in enum macros #1

Merged
merged 3 commits into from
Jun 27, 2022

Conversation

nicopap
Copy link

@nicopap nicopap commented Jun 23, 2022

Using struct expression and patterns is allowed in rust for tuple
structs. As per references. This allows us to simplify some of the
macros, and remove underscores from the utility module.

Using struct expression and patterns is allowed in rust for tuple
structs. As per references. This allows us to simplify some of the
macros, and remove `underscores` from the utility module.

- https://play.rust-lang.org/?gist=fd4cc2283fff6a6aade5dbe9427e44db
- https://doc.rust-lang.org/reference/expressions/struct-expr.html
- https://doc.rust-lang.org/reference/patterns.html#struct-patterns
Copy link
Owner

@MrGVSV MrGVSV left a comment

Choose a reason for hiding this comment

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

Definitely much cleaner. Left a few suggestions (feel free to dispute them if you feel strongly about them, though).

@nicopap
Copy link
Author

nicopap commented Jun 25, 2022

Nice suggestions! I'll update this tomorrow.

@nicopap nicopap requested a review from MrGVSV June 26, 2022 09:44
@nicopap
Copy link
Author

nicopap commented Jun 26, 2022

Applied all your suggestions

@nicopap nicopap force-pushed the reflect-enum-some-cleanup branch from d4df183 to 9f10360 Compare June 26, 2022 18:01
@nicopap nicopap requested a review from MrGVSV June 26, 2022 18:01
Copy link
Owner

@MrGVSV MrGVSV left a comment

Choose a reason for hiding this comment

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

Looks good to me! Great work!

Comment on lines +32 to +50
/// Returns a `Member` made of `ident` or `index` if `ident` is None.
///
/// Rust struct syntax allows for `Struct { foo: "string" }` with explicitly
/// named fields. It allows the `Struct { 0: "string" }` syntax when the struct
/// is declared as a tuple struct.
///
/// ```
/// # fn main() {
/// struct Foo { field: &'static str }
/// struct Bar(&'static str);
/// let Foo { field } = Foo { field: "hi" };
/// let Bar { 0: field } = Bar { 0: "hello" };
/// let Bar(field) = Bar("hello"); // more common syntax
/// # }
/// ```
///
/// This function helps field access in context where you are declaring either
/// a tuple struct or a struct with named fields. If you don't have a field name,
/// it means you need to access the struct through an index.
Copy link
Owner

Choose a reason for hiding this comment

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

Awesome docs. Thank you!

@MrGVSV MrGVSV merged commit 1f19587 into MrGVSV:reflect-enum Jun 27, 2022
@nicopap nicopap deleted the reflect-enum-some-cleanup branch September 5, 2023 15:44
MrGVSV pushed a commit that referenced this pull request Jun 26, 2024
…3905)

# Objective

- first part of bevyengine#13900 

## Solution

- split `check_light_mesh_visibility `into
`check_dir_light_mesh_visibility `and
`check_point_light_mesh_visibility` for better review
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.

2 participants