"""Rust"""

>here is your web framework bro

Attached: 2019-06-27-171640_612x670_scrot.png (612x670, 65K)

Other urls found in this thread:

doc.rust-lang.org/std/sync/mpsc/index.html
twitter.com/NSFWRedditVideo

looks good.

...if you programmed in Perl

no, perl's ambiguous and succinct. very much the opposite of rust. this is nice clean unambiguous code.

Syntax is a bit ugly but other than that it looks pretty nice, especially considering how high-level it seems despite being only compile-time abstractions over C.

the match statement doesn't really line up to any other lang's syntax but it's pretty easy to grok, the return is maybe a bit confusing but anyone who cepples recognizes the brackets for what they mean. Maybe babies somehow haven't been exposed to option types in current decade. If you know something about other programming languages but don't know rust it's not hard to divine what it does.

>a bit

I unironically cant understand shit of what is written in that pic

have you considered the possibility that you're just retarded?

it's like someone who has only programmed in javascript decided to make their own language which just grabs bullshit from all paradigms

>threadpool
remember when rust had channels?

does this generate a multipart response containing a file or writes a file obtained from the request on the server? I don't understand this shit.

at least they knew functional javascript

JavaScript is what pajeets on youtube claim to be functional programming.

its literally just save_file(), it creates a file opens it for writing and then writes bytes or errors. There happens to be a loooot of reasons a file write can fuck up though before they use a threadpool so thats mostly error handling.

that's the point, writing file to disc becomes mess no one understands

It's basically a gigantic one-liner with obfuscated control flow.

>bro just write 1000 characters code snippet to save file to disc

you don't have to write all that, you just call save_file

theres no control flow, only error handling. you could probably get away with a one liner if there weren't so so many possible errors to take care of.

Why couldn't you program functionally in JS? JS is a perfectly valid functional language, at least if you count languages without referential transparency.

"error" handling is control flow

>so so
stop doing this you fucking tranny

Honestly, if they didn't pick such a retarded way to intend and wrap this code on multiple lines, it would look a lot nicer and easier to read.

clean ? even C++ templates are more readable than that crap

That probably means you don't know folds or lambdas, which doesn't make the language bad, it makes you as a programmer bad.

i would stop but you people don't seem to comprehend just how fucked up and unreliable network and filesystem access are. you think a one liner that just works 40% of the time is good enough?

Debatable, there's templates in use here though. Cepples code handling the same problem would be at least this big and ugly.

>had
doc.rust-lang.org/std/sync/mpsc/index.html

>single-consumer
>also no longer in the syntax
shite

Dilate

>>single-consumer
>>also no longer in the syntax
>moving the goalpost

i'm sorry, i should have said "remember when rust had multiple-reader multiple-writer channels built into the syntax because graydon hoare liked that feature in limbo and alef?"

i bet this code would be more pleasant without fold and map. maybe it's time to stop wanking over stuff from 1932.

DAAAAAMN Rust contributors look like that?!

Attached: DyRGcW5WkAAS51x.jpg:large.jpg (1638x2048, 391K)

>i'm sorry, i should have said "remember when rust had multiple-reader multiple-writer channels built into the syntax because graydon hoare liked that feature in limbo and alef?"
You should've.
Also good riddance. If it was built into the language then how would you go about replacing it with a better implementation?

Maybe, the fold's pretty elegant on its own, assuming it would just werk instead of needing all the error handling.

>Also good riddance. If it was built into the language then how would you go about replacing it with a better implementation?
you're effectively saying a language feature's implementation cannot be modified. weird thing to say.

yeah "elegant" is what comes to mind

>you think a one liner that just works 40% of the time is good enough?
Yes, it fucking is. If it crashes, fine. Restart the process. Don't bog down my productivity with this safety meme.

its returning a future, its not bogging down anything.
>my productivity
doubt thats possible.

stop falseflagging you tranny cunt

>you're effectively saying a language feature's implementation cannot be modified
It can. But it is easier to just make your better channel have the same interface and change a few use statements.

this is so fuckign retaredfdlkjfadsl;kgjflj

based and Erlangpilled

I win

>returning a future
Spawn a thread, wheat eater.

This is really high level code and relatively complex code.
You could've rewrote all of these in a way you'd write it in Java, but it would probably take 5x times more lines. But if you are not a brainlet and have some experience in Rust, you should be able to understand and appreciate it. Especially if you are comfortable with functional programming.

Are you retarded? This is a library code, do you expect your stdlib to contain every single usecase like saving file from http multipart?

You aren't wrong, but I feel like Scala and ES6 can look just as bad too. Blame FP.

Rust is legit shit.

>error:BlockingError(MultipartError::Payload(error::PayloadError:Io(e)))
>here's your zero cost error handling bro

Even scala sounds easier.

Rust was never meant to be easy. It's literally autism driven development.

>using a programming language to generate a static web page
ISHYGDDT

still better than throwing a ton of expensive exceptions

>.fold(file, 0164)
>.map
>.map_err
wtf, why?

>acc += bytes.len() as 164;
>as 164
First all the code is written in a really meme functional garbage way but literally "as 164". I don't even care to know, either this code is a non-functioning joke or rust is.

One of the things that trigger me about Rust (and C++ of course) is that it uses the :: scope operator. It's so fucking ugly and uncomfortable to type.

as opposed to what?

Its syntax is so weird, it makes C++ look sane.
Like, what is "Move ||"? Probably something related to whether a closure is capturing or not, but that syntax is pants on head retarded.

What a fucking disaster
Mozilla was a mistake

This code screams tranny

It's i64, retard, not 164. Even I could tell it having never written Rust. Do you have dyslexia or something?

Rust is the ultimate brainlet devs filter, no matter how much they scream "TRANNY" they will never understand how powerful this language is

this is not library code, it's example how you should handle file uploads

i am just a normal monkey, who is trying to make money, but the last i hack the CIA i end up making 200k per year....... and they still thinking i can live with 200k per year......... and yeah, that is why i don' hack goverment stuff, because then i will force to be in poorberty my entire life.....

Attached: 350-3508605_saitama-son-goku-et-superman-preview-goku-clipart.jpg (880x761, 243K)

ironical or unironical shilling?

This is what the inside of a tranny brain must look like.

WTF I like C++ now

How do people even tolerate this shit

.map(|(_, acc)| acc)
does this shitlang really not have a snd function? who chose this fucking lambda syntax?

what was wrong with .

nothing, rust has .

so why couldn't it use that instead of ::

because it needed two or more things

Why are they using Either instead of Result?

You're can trivially create a trait to provide a "second" function of you're using it enough that lambdas are awkward, and that could have been written as .map(|x|x.1), but the author chose to be more explicit.

That's a pretty based and functional way to do things, OP. Are you some nigger faggot?