-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Added construction chapter #191
Conversation
02ae757
to
e29dbe8
Compare
src/methods/receiver.md
Outdated
|
||
<details> | ||
|
||
* In reality, all functions in rust are static. Receivers just add the "dot syntax" syntactic sugar by implicitly passing the struct by move, reference, or mutable reference. |
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.
That's not really true, method calls on trait objects are dynamic.
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.
Right, we should instead talk about the syntax, which allows you to call methods using the fully qualified syntax.
Hey @brandonpollack23 and @qwandor, since I plan on sqush-merging this, I've added a bunch of small formatting fixes. |
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.
We just need to move the file and then fix the small part about dynamic calls.
@@ -0,0 +1,43 @@ | |||
# Construction | |||
|
|||
Unlike in C++ or Java, there is no "constructor" in Rust for structs, all |
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.
I would like to add this content — it's great for the course participants if we can cover constructors.
Please move the file to methods/constructors.md
instead since constructors are not strictly about structs (they apply to enums too).
Then we just need to fix the small problem pointed out by Andrew and we should be good to go!
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.
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.
I think this will be in the methods slide?
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.
Yeah, I think so too.
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.
Yeah, I see it's mentioned on the slide about methods now.
Hi @brandonpollack23, can you check if we still need this PR? |
This is covered (a tiny bit) by #1073. |
No description provided.