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

MyStruct uses named fields #2

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

drmason13
Copy link
Contributor

MyStruct is currently a tuple struct, with a comment to describe what each field is.
By using a normal struct and what I'm calling named fields, we don't need the comments and the code becomes a little more readable.

This checks off another Rust feature, one that is very commonly used.

(a few other typo fixes snuck in here too, and I ran rustfmt which stretched out your list of programming languages)

Also FYI (For Your Information) - your example isn't runnable as an example because you've added it as a workspace in the cargo.toml. This is a bit weird!

I had to use cargo run -p e01-hello-world-friendbear to actually print anything.

a few other typo fixes snuck in here too
@friendbear
Copy link
Member

@drmason13

MyStruct is now a tuple structure, with comments describing what each field is.
Using a regular struct and what I call named fields eliminates the need for comments and makes the code a little more readable.

You are correct, I will also modify the main branch.

I had the idea of using Option as middle_name, so I had to make it a tuple.

This checks off another very commonly used feature of Rust.

Thank you. I have checked it.

(I fixed a couple of other typos as well.)

Also, FYI (For Your Information) - the sample cannot be run as a sample because it is added as a workspace in cargo.toml. This is a bit odd!

I had to use cargo run -p e01-hello-world-friendbear to actually display anything.

I will check and respond.

Thanks very much for your help.

@friendbear friendbear merged commit 416576b into cruise-group:main Jan 29, 2024
@friendbear friendbear self-assigned this Jan 29, 2024
friendbear added a commit that referenced this pull request Feb 21, 2024
friendbear added a commit that referenced this pull request Feb 21, 2024
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