RUST Enums ARE Better

preview_player
Показать описание
RUST does ENUMS better than Typescript and that’s a fact, no matter what they say.

### Twitch
Everything is built live on twitch
### Editor

Join this channel to get access to perks:

### Links

#coding #neovim #typescript #programming #vim #softwareengineering #codinglife #webdesign #webdevelopment #webdev #javascript #rustlang #rust #twitch #twitchstreamer #programmerhumor #codinghumor #software #softwareengineer #softwaredeveloper #softwaredevelopment #ruststring
Рекомендации по теме
Комментарии
Автор

first, also hey, let me know what you think about this code video? I tried to make LOTs of code, but cool and exciting. (also like the video, ty ty :))

ThePrimeagen
Автор

I really love this new style with showing the ctode, great video!

SkyKosiner
Автор

I feel so hyped to learn Rust every time you make a video on it

matheusnogueira
Автор

Oh my God, these animations and the code presentations are God tier! What the fuck is this super high quality!!! Also the explanations are top notch. The video is amazing! 10/10

nikensss
Автор

Seems very similar to language features from the FP world, specifically OCaml.

The match functionality with extracting out data from container values is so powerful that it serves as the basis for most algorithms in OCaml.

It’s pretty cool to see so many languages adopting FP language features like Python and Rust taking matching.

loucadufault
Автор

I love clear Result/optional types, these are soo much better then exceptions!

JannisAdmek
Автор

I am currently doing my CS undergrad and we are doing a one-year-long team-programming exercise. We have to do this in Java and in our code we basically have multiple enums that are templates to build functions out of. The hoops you have to jump through to make this a reality in Java are insane (we ended up coding a bunch of Factories) and I am quite jealous that it does not work like in Rust.

sebred
Автор

Prime, I loved this style of comparing code. Really, really helps and also really dig that colour scheme;)

algned
Автор

Waiting for more Rust jobs, to finally switch from TypeScript to Rust. I love TypeScript sooo much, I written lots and lots of code during 5 years of my career, but Rust seems to me to be my next step

DEVDerr
Автор

I know this concept from Haskell and Swift. They‘re great! I really hope, that there will someday be an equivalent in TS

StefanvonderKrone
Автор

Woah Prime! Calm down there! If you continue like this I'll end up learning rust

Westar.
Автор

enum RealProgrammingLanguages { Rust, Haskell }

teej_dv
Автор

Also pretty cool is that Option<Box> (which would be the same as a nullable pointer) actually is represented as a single nullable pointer in memory, since rust knows that the pointer (Box) cannot be null, and therefore uses null to represent None.

throwaway
Автор

It's really crazy how readable rust can be if you don't try to get too fancy. Loving getting to work with TS and Rust on my 2 projects right now

scottiedoesno
Автор

I remember learning how Rust enums can hold a subtype and it blew my mind.

logannance
Автор

You can use typescript enums to enforce that each case is matched. It's not on by default which would be nice, but you can get it to give you a type error by sending the variable you're switching over to never.

function getColorName(c: Color): string {
switch (c) {
case Color.Red:
return "red";
case Color.Green:
return "green";
// Forgot about Blue
default:
const exhaustiveCheck: never = c;
throw new Error(`Unhandled color case: ${exhaustiveCheck}`);
}
}

charlesoconor
Автор

This feels pretty similar to Java enums. What I like about Rust's approach is having errors propagate as values, since like you said, you know exactly what you're getting just from the return type including potential errors

chatt
Автор

This type of format is so good. I feel that re-watching the video does not tire me at all if I don´t get the concept in the first run.

jocdiazm
Автор

The result types feel similar to Java checked exceptions. Interesting, in general I think the industry moved over to unchecked exceptions due to the caller not being able to handle properly all the possible exceptions. Seems like in Rust this works better I suppose?

Also was glad to see that Kotlin enums share some similar traits as Rust which is neat.

Great job with the code highlighting Prime! Did use any programs to achieve this darken / focus effect on the code?

techwithattila
Автор

While this video may not be the best performing video, the knowledge packed into it is stellar. Thanks for making it Prime.

FinalSentinel