I'm trying Rust for the first time, is this what it feels like to be a brainlet?

I'm trying Rust for the first time, is this what it feels like to be a brainlet?

Attached: Screenshot from 2019-06-23 21-17-34.png (1356x382, 76K)

Other urls found in this thread:

doc.rust-lang.org/stable/edition-guide/rust-2018/ownership-and-lifetimes/the-anonymous-lifetime.html
doc.rust-lang.org/beta/rust-by-example/scope/borrow.html
doc.rust-lang.org/1.9.0/book/lifetimes.html
amethyst.rs/
twitter.com/AnonBabble

Trans language

>whats this shit?
maybe a mutable reference?
t. never used rust.
context isn't that hard user..

Try reading docs Rakshit

It's not your fault. The syntax is atrocious

Yeah, but like, does it treat the first argument as special? Can I type "&const self"?
Never had to read docs to learn C++.
Seems like it. I never had a problem managing pointers in C++ but I like the build system, the improved stdlib and SOME of the new syntax.

This is what happens when a homosexual designs a language.

mutable
error checking

simple as

After all these years one would assume that everybody knows what good syntax is. Why come up with this shit?

>mutable
See Apparently I can type "&const self" but the docs tell me "self" refers to the module. I think a module is the same as a namespace but I thought "self" was the same as "this" in C++. How can I make a module const or mutable?
>error checking
What exactly does '_ or () mean? Do I need to go through hundreds of pages of docs to figure out?

It's really dumb how they changed some of it around from C++ for NO reason. Like "int i" -> "i: int", "this" to "self" or "namespace x" -> "module x". I thought this language was supposed to replace C++, shouldn't they make it easy for C++ programmers to get into?

Also you have "crates" that you download with "cargo" because of course you have to be quirky and clever and you can't just call them class libraries.

>What exactly does '_ or () mean?
see: doc.rust-lang.org/stable/edition-guide/rust-2018/ownership-and-lifetimes/the-anonymous-lifetime.html
also: doc.rust-lang.org/beta/rust-by-example/scope/borrow.html

apparently it's for specifying lifetime for references or something like that. (pls correct me if wrong).

1. Mutable reference to itself. Meaning that a function defined on a struct can change the state of the struct.

2. Named lifetime. I'd explain it, but the book does it better: doc.rust-lang.org/1.9.0/book/lifetimes.html

3. Just a void. The function either returns nothing or an error.

4. try operator. Unwraps the result or propagates any error that occurred.

Syntax is horrible, with the added bonus that when you have a lot of free time and invest it into actually figuring out what's going in this language, you then feel really smart, when all it means is that you have a shitload a free time you're willing to waste

Thanks user. I'm gonna read through it later and try to learn.
>Mutable reference to itself
Like I said, does it treat the first argument as special? Do I need "&self" or "&const self" if I don't need to modify the struct?
>Just a void. The function either returns nothing or an error
Thanks. Result would have been way clearer.
>try operator. Unwraps the result or propagates any error that occurred
This would be done implicitly in C++, right? Is that the same as ".unwrap()" I keep seeing?
I DO have a shitload of free time for the next few weeks which is why I'm learning Rust.

>3. Just a void. The function either returns nothing or an error.
NO. This is an empty tuple

>4. try operator. Unwraps the result or propagates any error that occurred.

NO. The "?" just returns the error to the caller function. It doesn't unwrap.

What's an empty tuple? Like a "struct { }"?

>let
>fn
>_
>self
What do people do this?

>itt: brainlet somehow unable to read 10 pages rustbook

Attached: yoba_s_podlivoi.jpg (302x455, 61K)

empty tuple is self explanatory, in the case of empty structs you can define methods and traits but you can't do that with tuples

{ unsafe tranny language}

It's ok user, maybe python fits you better.

Cniles are functionally illiterate

rust is a nice little language, but the borrow checker is a fucking whore and makes using the language borderline unbearable after a few hours of work.
op, just stick to c++, you will drop rust sooner than later, and in that time, you could have advanced your c++ skills.
learn the basics, then put it on hold, until the language gains more momentum in the industry.

at the moment, it's just not there.

>always complaining about C++ syntax
>rust syntax is even worse
As expected of mentally ill shills.

When the first argument of the function is "self", it actually means, that you can call that function on an object like this: coordinate.get_x()
The first argument to get_x(&self) is then automatically the coordinate object.
Its equivalent to get_x(coordinate)

"&mut self" is a statement that the writer of this code is mixed race.

I understand that, I was just wondering about the significance of having it in the argument list. What's actually happening is that &mut self is the same thing as self: &mut Self and that's the same thing as self: &mut MyState. I still don't know if the argument is REQUIRED to get the self object.

>trying to make something that runs on gamestates with a language that actively opposes that
yes, you are retarded

'_ is pic related.

Attached: 1561325060424.png (357x633, 56K)

amethyst.rs/