My Experience with Rust as a Java Dev

Поділитися
Вставка
  • Опубліковано 31 січ 2025

КОМЕНТАРІ • 172

  • @EdElliott57
    @EdElliott57 Місяць тому +36

    I"m loving Rust for long-running processes I've been writing to migrate data between different Salesforce Orgs as it just runs for days if it needs to. Killing all the bugs at compile time is very helpful in that respect.

  • @MePatrick73
    @MePatrick73 Місяць тому +78

    I think there's a misunderstanding here regarding traits in Rust. Traits are both Generics and Interfaces, and the way they work differs from Java.
    In Rust, impl YourTrait or are compile-time interfaces. When you use these, Rust generates specific code for each type that implements the trait. This process is called monomorphization and ensures zero-cost abstraction, meaning no additional runtime overhead.
    Monomorphization allows you to define a contract for your inputs (through traits) and still have efficient, specialized code for each type at compile time. This is why Rust can offer powerful abstractions with no runtime cost.
    In contrast, &dyn YourTrait in Rust is for runtime polymorphism and is similar to Java interfaces. When you use &dyn YourTrait, you are creating a trait object that allows for dynamic dispatch at runtime. This is essentially equivalent to Java's interface system, where you can pass around different concrete types that implement the interface, and the method to call is determined at runtime.
    In Java, interfaces are purely runtime constructs. If you want to handle types that are Comparable, you would use the Comparable interface. However, in Java, you can't specify that a particular class must implement a method (like compareTo) without having to go through vtable checks at runtime.
    While Rust doesn’t strictly follow the Object-Oriented Programming (OOP) paradigm in the traditional sense, it still supports message passing and polymorphism through traits. This approach is what OOP originally focused on - defining behavior through interfaces or contracts - and Rust does it with zero runtime cost for compile-time traits and with dynamic dispatch for runtime traits.
    I’d recommend reading the Rust Book section on monomorphization and polymorphism. I believe you’ll find that Rust’s trait system aligns closely with OOP principles, but with much more efficient abstractions.

  • @xMaticusfinchx
    @xMaticusfinchx Місяць тому +17

    I'm really feeling like I'm following very closely in your footsteps. I'm primarily a Java developer (hit my 5 year professional mark in October), and I'm really wanting to learn Rust. On top of that, I've switched to Neovim as my editor this year. I'm glad I'm not the only one to make comparisons between life and programming lmao. Good luck on your Rust journey!

    • @toby9999
      @toby9999 Місяць тому

      I've been a C and C++ dev for 28 years. I decided to try rust, but it did my brain in real quick. Didn't like it. It was 10% writing code and 90% head against brick wall.

    • @RustIsWinning
      @RustIsWinning Місяць тому

      ​@@toby9999 OLD and B4LD --> ♿️ LOL

  • @johanngambolputty5351
    @johanngambolputty5351 Місяць тому +85

    1:42 why don't you have rust-analyser enabled? You can get those errors live as you type.
    4:00 in rust, when you finish drinking, your mug is automatically de-allocated ;)
    9:00 traits allow you to write higher level logic, without assuming a backing type. For example, writing a function that does something to every element of a vector, versus any object that implements iterate, in the latter case you can use it also for arrays, hashmap values, whatever.
    13:00 this bit is probably it just being a newer language, there's a lot of benefits of hindsight when it comes to things that turned out to be inconvenient about older build tools.
    16:00 I don't like this way of putting it "rust forces you to do X", again, with the benefit of hindsight you've hopefully already realized that doing X is a good policy when writing code and saves you headaches in the longrun, rust just automates the process of checking that X is done, which is what you were going for all along anyway, e.g. trying to not have other pointers when you have one mut one (it's easy to miss one out, hard to scour your codebase to see where you slipped up, good to be able to be sure it hasn't happened).

  • @eaglethebot1354
    @eaglethebot1354 Місяць тому +14

    Traits are awesome. I think of the language as a buffet since you mostly opt in to behaviors / patterns vis composition, and you get to assemble your plate with whatever you want (traits, generics, impl struct), but the chefs that offer the food use their combined experience and knowledge to prevent you from choosing a bad combination of food items (borrow checker + compiler).

  • @layer4down
    @layer4down Місяць тому +28

    Two devs walk into a restroom and take a piss. Java dev proceeds to sink, Rust dev proceeds to the door:
    JavaDev: “In Java, they teach us to wash our hands after we pee.”
    RustDev: “In Rust, they teach us not to piss on our own hands.”

  • @jr-dev-yoru
    @jr-dev-yoru Місяць тому +4

    As someone fairly new to programming, Rust is a hard but excellent experience. The Rust Programming Language book is amazing so far, the compiler screaming at you all the time but giving you precise info what went wrong and how to fix it and Cargo giving you docs for dependencies that you can run in your browser using cargo doc --open is like a dream developer experience. Coming from javascript hell, I fell in love with rust and it's ecosystem. It being a low-level language teaches you a lot about how computers work and that is also amazing

  • @realtitedog
    @realtitedog Місяць тому +14

    About Vec::new() vs vec![], if you look at how the vec![] macro works, under the hood it calls Vec::new() if you dont provide any parameters, so you can use either one, personally I use Vec::new() though because I think it has better readability 😁

  • @AlexandreJasmin
    @AlexandreJasmin 12 днів тому

    It's nice hearing your experience.
    Nitpick at 1:51 *Level* didn't "get cleaned up". The distinction matters in C++ where the moved-from value keeps existing and must be left in a sane state. For instance by implementing move on Vec so that the moved from vec is cleared to avoid a double-free of the data on destruction.
    With the Rust ownership model, the compiler ensures the old value doesn't "exist" anymore so it doesn't have to be cleaned up and we can forget about it. It's simpler and cheaper.

  • @RuskiRozpierdalacz
    @RuskiRozpierdalacz Місяць тому +8

    As Java dev I found Rust to be surprisingly similar to Java in code readibility. Way more than for example Go. For business logic-heavy software I would stay with JVM languages but I really like Rust for tinkering with microcontrollers and would be okay with using it if I have to write extremely performant software.

    • @costathoughts
      @costathoughts 26 днів тому

      I think it's because Rust has some functional approach where I have to agree with you that in this case annoying me on Golang once you don't have any. However, in the lastly versions after the inclusion of generics they are improving it

  • @havocthehobbit
    @havocthehobbit Місяць тому +26

    welcome to the cult of the crab, we like it here

  • @mx-5driver406
    @mx-5driver406 27 днів тому +2

    Nice video. You seem to be on the right track, and as long as you keep an open mind to learning Rust idioms and not try to use Java patterns in Rust, you're gonna be fine and have many more epiphanies. Btw, once you learn about iterators you won't write code like those Vec examples anymore :)

  • @antoniong4380
    @antoniong4380 4 дні тому

    11:57 actually the closest thing to an inmutable object are Records, not final.
    Final are still lacklusting because anyone using them might think they're giving something that doesn't change, but then find out what it only does is you don't accidentally replace the variable's object with another one

  • @bpo217
    @bpo217 Місяць тому +2

    Based on your experience and since you asked, my advice is: don’t be afraid to name lifetimes and generic types other than ‘a or T or whatever. Lifetimes and generics will propagate throughout your type tree and knowing what specific lifetime they are referring to or generic type you are referring to is really helpful for understanding or connecting things together. The type system is basically its own language and to make the intent readable for yourself or someone else later, name things in this space accordingly. T or ‘a is being lazy unless it’s really simple. Rust is a great programming language and once you see what I am talking about here in some more complex situations you’ll realize, which is my second tip: before you start a Rust project: do I really need to make this perfect zero abstraction tool or can I let go and do it good enough with something else?

  • @Psy45Kai
    @Psy45Kai Місяць тому +4

    Some advice when coming from heavy oop languages to Rust: learn to properly devide data from functionality!
    In oop wie learn that data should also do things (looking at you shape-drawing example!). But in rust you should have types for data (which maybe have conversion functions) and types with real functionality!
    E.g.: String is data. You have some functions to create and concert from and to strings. But you shouldnt have a function which write to a file attached to the string! Writing somewhere is functionality. So you will have some types like File and TcpStream which have the functionality to write to a file in the filesystem or to via a tcp-socket.
    Having this mental model of data vs functionality makes writing code much easier! But it should not be a hard rule in the long run!
    E.g.: you want to write to memory instead into a file. Thats why Vec (data) implements the Write-trait (functionality). Having an extra VecWriter would be overkill hence mixing data and functionality in *some* cases might be ok.

    • @_Squiggle_
      @_Squiggle_ 24 дні тому

      I don't know anything about Rust. What about String.lenght() or String.toUpperCase() is that not functionality attached to your String data?

  • @DanielSantanaBjj
    @DanielSantanaBjj 29 днів тому +1

    Many times, especially with AoC I catch myself using neither vec![] or Vec::new but Vec::with_capacity(N) where N is a usize value.
    Which creates a vector and pre allocates the space on the heap for N elements of the Vec’s type.
    Which gives you a slight performance advantage when you have knowledge of your data since it will not have to resize the vector and move all the values to another memory address while you add elements to it.
    And if you are dealing with small lists of values that are immutable and predefined at compile time it’s best to use arrays instead of vectors since they are allocated on the stack

  • @sstijn577
    @sstijn577 Місяць тому +4

    5:42 you say when levels is mutable only one & is valid, this is not the case, you can still have as many of those immutable references (&T) as you like OR you can have ONE SINGLE mutable reference (&mut T), think about it in terms of data races. I can have multiple READ ONLY references without any issues, but I can't have thatnwhen there is a READ/WRITE reference in the mix, same reason as to why only 1 &mut T is allowed, not multiple (T is just a placeholder for a type here)

  • @piyushgaming4270
    @piyushgaming4270 7 днів тому

    This is my first video about rust that i watch with focus and i really started like it . specially after learning lit bit about c++ and being js dev

  • @alexgghlebg5375
    @alexgghlebg5375 Місяць тому +3

    I have used and learned many programming languages, starting with Python, then C and C++. I love Rust because it’s easier to write purpose-driven code in Rust compared to C++. I also enjoy working with pointers and references, which are implemented in C, C++, and Rust but not in Python. Since I started learning "low-level" programming, my brain has naturally shifted to thinking and coding with pointers and references because they are both efficient and intuitive.
    As an intermediate-level Rust developer, I’ve encountered significant challenges with multithreading. For example, I once tried to use 8 threads to send over 50,000 queries via HTTPS to an API. The main issue I faced was related to borrowing and the borrow checker when working with shared resources, such as a buffer to keep track of what had already been sent.
    It’s a bit embarrassing to admit, but while Rust is an amazing language, every time I try to tackle multithreading, it feels too complicated for me. As a result, I often end up reverting to C++.
    If you have any advice, I’d really appreciate it.

    • @raidensama1511
      @raidensama1511 Місяць тому +2

      Async (Tokio) is challenging for sure. But take your time, go slow and enlightenment will greet you.

    • @toby9999
      @toby9999 Місяць тому +1

      Rust is much more difficult to learn and use than C++ in my opinion. I can do anything I want to do in C++, so I've abandoned rust. It effectivelly offers me nothing but headaches. As for multi-threading, I've developed them in C++ without any issues. I'm not sure what additional benefits rust provides there, but it does make everything 10x harder.

    • @Heater-v1.0.0
      @Heater-v1.0.0 Місяць тому

      @@toby9999 As a user of C++ over decades and having got into Rust 4 years ago I really don't understand how one can find Rust more difficult. C++ is a huge and complex language, no single human knows all its features and how they interact with each other. C++ inherits all kind of foot guns from C and adds more with every new standard, to use C++ reliably one needs to be familiar with hundreds of coding guide lines and constantly check ones code against them. Sure the Rust compiler complains a lot, but that is only enforcing all those good rules that C++ programmers have to learn from coding standards or hard experience debugging their code. No way does Rust make things 10 times harder than C++, unless of course you are trying to use it as C++.

    • @raidensama1511
      @raidensama1511 Місяць тому

      @seems as if you’re bitching and moaning about skill issues. Admit it, you don’t like the language because of the hype and the foundation. Don’t hate the language… hate the foundation.

    • @glebzenkov396
      @glebzenkov396 28 днів тому

      check rust thread::scope function - scoped threads allow you to share immutable data by simple references.
      If you need to mutate data from multiple scoped threads - you have to use Mutex (or RwLock)
      For not scoped threads you may use Arc. This should cover most of the scenarios you may encounter.
      Interesting thing is: those patterns for sharing resources between multiple treads are universal across different programming languages, including C++. The difference is that C++ doesn't check if you are using them correctly and doesn't protect you against possible data races / race conditions or lifetime mismatches.
      So it may look like C++ multithreading is simpler, but it is only because the actual hidden complexity will eventually manifest itself as runtime bugs (very difficult to catch), while in Rust you will have just a compilation error

  • @misc10k
    @misc10k Місяць тому +5

    Personal anecdote - I had a lot easier time learning Rust for the second time by spending a few weeks with Elixir, beforehand, to better grasp functional programming concepts and shift my OOP-only mindset.

  • @analisamelojete1966
    @analisamelojete1966 Місяць тому +5

    Cargo is excellent. Made managing projects dependencies easier.

  • @costathoughts
    @costathoughts 26 днів тому

    The ownership part it's like in Java (if do you use any check style), we should avoid create/ copy values that we won't use. This in small project is not a problem however in load system you are spend and put more load into your GC and it might fall into a memoryleak. I agree with this approach from Rust and Golang.

  • @jvcmarc
    @jvcmarc Місяць тому +2

    As a Rust dev (2 years working with it professionally) your understanding is on point! Great video, awesome seeing you're enjoying the language as much as I do
    The epiphanies are real when you're first learning it, I was coming from a mostly C# background. But I knew some F# too which helped me with the more functional aspects of Rust
    Oh, and about how to initialize vectors, I absolutely despise the vec macro, I think it shouldn't be in the standard library at all. It was necessary a few years ago, but today there's no reason, I hope it gets deprecated. To explain:
    macros are harder to understand (they can do any magic they want), they slow down compilation, and on some IDEs (such as vscode) it breaks code completion and hints
    I use Vec::new when creating empty vecs, and Vec::from when creating a vec with data. As an example, you could write Vec::from([1, 2, 3])
    This Vec::from approach wasn't the best a few years ago, Rust didn't have a way to allocate sufficient memory so it could cause reallocations during initialization. But since then the language team has implemented some features (const generics) that solve that issue
    Well, that's my rant about the vec macro.
    Again, great video!

  • @laundmo
    @laundmo 13 днів тому

    small sidenote/hint that's probably way too late: instead of .collect()-ing a iterator into a vector, looping over it, and pushing elements to a new vector do thus:
    use .map(|e| { e * 2 }) to convert every item in your iterator, .filter(|e| { e > 6 }) to filter the elements, etc, and collect the result of that. There many more iterator methods than just these, rust-analyzer should autocomplete them (or look at Iterator trait docs).

  • @berkesadam759
    @berkesadam759 21 день тому

    I can listen to you for hours, thank you :)

  • @liteflow10
    @liteflow10 26 днів тому

    vec![] os good to use. Vec::new() is good when you don't have initial data and don't know the length, and there is Vec::with_capacity(). Its good to use when u know how big the length would be. Just eliminating unnecassery allocations

  • @DomainObject
    @DomainObject Місяць тому

    Great video. Nicely framed description of your Rust journey.

  • @rockNbrain
    @rockNbrain Місяць тому

    I'm learning Rust for about two months, and it's being great ! I hope the language gets traction by the tech market 🎉

  • @costathoughts
    @costathoughts 26 днів тому

    As a Java brow I understand u continue the series I am loving! Traits is sucks no one know about that and it existis in Scala and the optional it is the Either interface from Scala that is a soooooo good! Java 24 is going to this with the sealed classes and pattern matting enhancement :chefkiss: it's just amazing trust me

  • @Iuigi_t
    @Iuigi_t Місяць тому

    5:43, not exactly. Each variable can only have one mutable value/reference or multiple immutable references. So, either a single writer or multiple readers.

  • @adrianford468
    @adrianford468 Місяць тому

    Although Rust is complicated i feel like it gives a different insight to approach coding I love it. Only started learning it to build desktop apps in Tauri. But you can build fullstack website using Rust with Dioxus and using diesel as a Postgres ORM . Sometimes documentation is not to clear but that’s what makes Rust great, not being suited up like JavaScript completed libraries. sometimes get the feeling of being your own personal Ryan Dahl

    • @voidwalker7774
      @voidwalker7774 Місяць тому

      Why use an ORM? Just Sqlx and RAW SQL. Make performance go brrrrrrrrrrrrrrrrrrrrrr

    • @adrianford468
      @adrianford468 Місяць тому +1

      @ this is why we have these conversation I’m going to research your option

    • @toby9999
      @toby9999 Місяць тому

      Why does bad documentation make a language better? That seems counter intuative to me. And in fact it's one of the reasons why I've already abandoned rust. It's a battle I don't need to fight.

    • @RustIsWinning
      @RustIsWinning Місяць тому

      ​@@voidwalker7774Truee. Always raw 🐶 the queries lol

  • @deezydoezeet
    @deezydoezeet Місяць тому +1

    You're on the right track boss!

  • @olacurrency
    @olacurrency Місяць тому +2

    I am exactly at the same stage with you on Rust and I have the same feeling and enthusiasm.
    I have originally left Java for GoLang as a primary language for concurrency reasons but then moved to C# which IMO brings what I want in Java and Go into one.
    I am now learning Rust and I found it strict and intentional just like you which I am loving by the way.
    C# is still my go to language but I am loving it with Rust.
    FWIW: I think traits are actually more of abstract classes than interfaces as it forces you to implement those behaviors but I might be wrong.
    Also, I have read bad things about Rust concurrency and multithreading so I am not yet excited about that. Good luck to us and you are becoming my favorite UA-camr. 😊

    • @k16style
      @k16style Місяць тому

      Take a look Zig

    • @RustIsWinning
      @RustIsWinning Місяць тому

      ​@@k16style Zig = Segfault 😂

    • @mrcrazyenough007
      @mrcrazyenough007 Місяць тому

      What will be your advice for JavaScript dev (specifically Node.js) transitioning to Rust? Because I am trying to switch to JavaEE instead, just to get out of this startup web dev culture and setup into the Enterprise world with Java. But lately I came to know that with rust you will get know more about computers, because it's all about system programming, but I suppose I might find it really hard to move to Rust as a System Programmer from Node.js as a Web Developer, given that my professional experience with C/C++ is nearly 0.

    • @eyz-4
      @eyz-4 28 днів тому

      @@mrcrazyenough007 rust was my first systems language. i think it's easier to learn rust if you aren't already familiar with systems programming. it will still be difficult though because it's vastly different from gc languages. it took me a few weeks to feel comfortable. i would recommend starting out with something like axum or another web framework. that way you can learn the language through web development. or maybe if you're more into frontend you could try leptos or dioxus.

  • @CrayonEater9845
    @CrayonEater9845 Місяць тому

    Definitely try Kotlin. Baking null-ability into the type system is awesome. I went back to Java after years of kotlin and missed all the conveniences

  • @ReedoTV
    @ReedoTV Місяць тому

    Option is java.util.optional without the overhead of it being wrapped in an object.
    match is Java 23 switch expressions.

    • @ReedoTV
      @ReedoTV 27 днів тому

      @stysner4580 Yea that's what I said...

  • @bentels5340
    @bentels5340 Місяць тому +2

    I've tried to get my head around Rust. True, my major problem is that I have nothing to use Rust for and I can't build any actual experience. But I hate the borrow checker. It's just a mountain of frustration.

    • @toby9999
      @toby9999 Місяць тому +1

      I've tried rust, but I'm not into self-inflicted pain, so I've decided it's not for me.

    • @Heater-v1.0.0
      @Heater-v1.0.0 Місяць тому

      Languages like C and C++ also have data ownership and data lifetimes and hence they have issues with mutable references. The difference is that languages like C and C++ have no notion of ownership and lifetimes in their syntax and semantics. Their standards documents hardly mention such issues. Instead one finds out about data ownership and lifetimes when debugging crashes and data corruptions at run time.
      So yes, the borrow checks may seem frustrating but the problems it is saving your from exist in C, C++ and other languages just as much. Fixing the mistakes one can make in this languages at run time is even more frustrating.
      If you come from a Java or other background you likely have no idea what it's about yet.

    • @reybontje2375
      @reybontje2375 Місяць тому

      In general, I've found that you don't usually need to get into wrestling matches with the borrow checker. The only places you need to worry about borrowing is with code that needs to be insanely performant, which is not most code.
      In general, you can opt out of the borrow checker by using derive clone. Also, instead of &, which is checked by the compiler, you can use Rc/Arc. If you need mutable references, you can use Rc or Arc. Sure, your program essentially becomes a garbage-collected program (the Rc or Reference counter just counts your objects instead), you can save the garbage counting or cloning for things that actually need it like global state.
      I've also found that proc_macros can really cut down on verbosity in a lot of places.

    • @Heater-v1.0.0
      @Heater-v1.0.0 Місяць тому +2

      @@toby9999 I'm curious. Which language do you use to get your pain? After using a dozen or more languages, compiled, interpreted, virtual machined, JITed, whatever, I have found that they all have their pain points. Rust at least offers some important tangible benefits in return for a little pain.

    • @Heater-v1.0.0
      @Heater-v1.0.0 Місяць тому

      @@reybontje2375 I agree. I have written quite a bit of Rust in the last five years, much of which has been running in production for about that long, I almost never have problems with th borrow checker.. And when I do it the same kind of lifetime problems one would have in C or C++ and not find out until weird crashes and corruptions start happening at run time. Most of my Rust code reads as simply as something like Javascript.

  • @TypicalHog
    @TypicalHog 11 днів тому

    I love Rust because it fixes everything that bothered me in all other languages. I can't describe how satisfying it feels.
    Everything that triggered my OCD in let's say C++ Rust handles in a way that feels almoat magical.
    It's like people who created Rust took everything good from other languages and managed to fit it all together into a single end all be all language.

  • @emvdl
    @emvdl Місяць тому +2

    Have a deep look at enums, that will give you a lot of insights

  • @NotherPleb
    @NotherPleb День тому

    Hey Java dev, lemme help: let mut reports: Result = line.split_whitespace().map(str::parse).collect();
    Rust really favors functional patterns like iterators, you'll get a much better time if you embrace it. If you're collecting intermediate vectors there's probably a better way.

  • @rodrigofernandes6449
    @rodrigofernandes6449 Місяць тому +1

    have you tried bevy?

  • @cactusnormal2059
    @cactusnormal2059 Місяць тому +1

    What is the vscode theme ?

  • @christophrohde1415
    @christophrohde1415 21 день тому +1

    As a Java developer who doesn’t like unsafe features such as null pointer exceptions, mutability, and verbose syntax, and who loves Rust’s performance, safety, and tools (though I am sometimes scared of its weird syntax), I believe Swift is the optimal solution.

  • @kaleabgen9358
    @kaleabgen9358 Місяць тому +1

    really you are my motive to learn coding, am sure you will see this comment
    so it really be helpfull if you make like video of saying that like talking about your old time videos like when you were learning c.scince live video of how i learn to code , then i learn html by this i learn this by this it's really helpfull

  • @Walker299
    @Walker299 Місяць тому +1

    Generics are sick. Return a result if the functions dealing with like io and may fail and use option when the values might not exist like a potentially null/none field in a struct.

  • @AK-vx4dy
    @AK-vx4dy 11 днів тому

    15:16 I rembwr the time when i was sure that indentation is for weak 😅

  • @kamertonaudiophileplayer847
    @kamertonaudiophileplayer847 7 днів тому

    Tell also about a multi tasking. You can start using threads in Java a right away, you do not care about synchronization and things right that. Sure you can add a synchronization if you feel so. But no way to do same in Rust. It's a very terrible language, but you can use it, trust me.

  • @baejisoozy
    @baejisoozy Місяць тому +42

    Still learning neovim? First week is brutal.

    • @raidensama1511
      @raidensama1511 Місяць тому +4

      Don’t give up. Sooner rather than later you’ll be a “pro”

    • @jonatasscdc
      @jonatasscdc Місяць тому +5

      Try to program in Rust, inside neovim, in a kali linux VM that keeps crashing because you run out of space in your main machine. That is how I am ~crying~ learning Rust, or trying to.

    • @daveinthesky
      @daveinthesky Місяць тому

      First week is brutal. Third week is bliss.

    • @RustIsWinning
      @RustIsWinning Місяць тому +4

      ​@@jonatasscdc Why a VM and why kali linux? Also how much RAM does the host have? So many questions lmao

    • @SpectreFury
      @SpectreFury Місяць тому +4

      Wait a few weeks and you won't be able to use anything other than vim key binding

  • @danikvitek6845
    @danikvitek6845 28 днів тому +1

    here is an example of an invalid single-threaded code, that is not possible to write in Rust, thanks to the borrowing rules:
    ```rust
    let mut a = vec![1, 2, 3];
    for n in a.iter() {
    a.push(*n);
    }
    ```
    Trying to modify a vector while iterating over it

  • @Lado93
    @Lado93 Місяць тому +1

    1:58 when you use cargo clippy you will get further suggestions from improving code...rust is really good.

  • @StEvUgnIn
    @StEvUgnIn 28 днів тому

    Why would you recommend Rust instead of Go, Haskell, Kotlin and Scala?

    • @mx-5driver406
      @mx-5driver406 27 днів тому

      None of those languages are good for system level programming which is what Rust is made for

    • @StEvUgnIn
      @StEvUgnIn 27 днів тому

      @@mx-5driver406 No, Kotlin has shown it is possible to implement a system level with a LLVM compiler. Jetbrains just does not have the resources to compete with the likes of Google and Mozilla in this area.

    • @RustIsWinning
      @RustIsWinning 27 днів тому +1

      ​@@StEvUgnInLearn what system programming language means

    • @ClimateChangeDoesntBargain
      @ClimateChangeDoesntBargain 14 днів тому

      also none of them are as good for creating SPAs as Rust

  • @justindouglas3659
    @justindouglas3659 25 днів тому

    You should try go and elixir

  • @jasnarmstrng
    @jasnarmstrng Місяць тому +1

    Wholesome vid.

  • @unskeptable
    @unskeptable 12 днів тому

    Why use Java when there is C# ?

  • @thezachdrake
    @thezachdrake Місяць тому +2

    The Matthew McConaughey of computer science out here....

    • @haathimmunas1563
      @haathimmunas1563 Місяць тому

      Dude I was thinking about the exact same thing😂😂

  • @sumaech3813
    @sumaech3813 28 днів тому

    woah, I just started watching your videos. you sound so much like Nick Carver with how you speak

  • @technerd3455
    @technerd3455 Місяць тому

    bruh becoming a rust bro 🔥🔥

  • @akagamishanks7991
    @akagamishanks7991 Місяць тому

    The analogy was so on point lmaoo

  • @clymbep3390
    @clymbep3390 Місяць тому

    3:35 well i think im a java dev (never code on java)

  • @Luddekn
    @Luddekn Місяць тому

    Hows the nvim experience treating you? :D

  • @Soso-km8er
    @Soso-km8er Місяць тому

    I tried to like Rust but it has the same issues as other (modern) languages. Once you start doing something interesting you will quickly get stuck in unmaintained, incomplete libs/bindings, the quirky side of tooling pops up and therefore productivity is not what you expected. Java/C++ may have its quirks too, but at least there are billion-dollar project in the industry that also need to get those solved.

  • @Thato_M-00
    @Thato_M-00 Місяць тому +1

    Im definitely way too early, be back in an hour or two

  • @thegeniusfool
    @thegeniusfool 22 дні тому

    If you want to understand traits better and deeper, the best analogs are, once you have noticed the overlap between those traits and Haskell type classes:
    1. Theoretically it is a Concept in the paradigm Generic Programming.
    2. The C++ traits from STL days which are mostly handled by “concepts” in C++20.
    Look at them and jump back and forth.
    But… Rust traits allow both the dynamic dispatch of type classes and compile-time choice as in C++ templates.
    Hopefully, Rust traits will become as rich as C++ templates even ut comes to partial specializations one day.
    Good luck!

  • @rajatagnihotri7887
    @rajatagnihotri7887 Місяць тому

    Amazing video

  • @nandans2506
    @nandans2506 22 дні тому +1

    In the process of doing everything right and explicit, rust brings in too many concepts at once. You need to know a lot of things before you build what you want to. It's not practical for fast moving projects with newbies to rust. But if you want to build something robust and performance critical and you have core team of amazing engineers rust is beautiful. It does almost everything right and there's so much to love

  • @chadzulu4328
    @chadzulu4328 Місяць тому

    The borrow checker is like the schoolmaster's wife in Pink Floyd - The Wall.

    • @Heater-v1.0.0
      @Heater-v1.0.0 Місяць тому +1

      The borrow checker is like your loving mother or father that gave you a good spanking as a child when you went off the rails, because they loved you, because they wanted you to grow up knowing right from wrong.

    • @chadzulu4328
      @chadzulu4328 Місяць тому

      @@Heater-v1.0.0 Yeah, you're right.

  • @nguyentunglam47
    @nguyentunglam47 12 днів тому

    lol, this guy looks little bit like tom cruise in the last samurai movie!! i swear haha

  • @todd.mitchell
    @todd.mitchell Місяць тому +1

    15:44
    Nuns Fret Not at Their Convent’s Narrow Room
    By William Wordsworth
    Nuns fret not at their convent’s narrow room;
    And hermits are contented with their cells;
    And students with their pensive citadels;
    Maids at the wheel, the weaver at his loom,
    Sit blithe and happy; bees that soar for bloom,
    High as the highest Peak of Furness-fells,
    Will murmur by the hour in foxglove bells:
    In truth the prison, into which we doom
    Ourselves, no prison is: and hence for me,
    In sundry moods, ’twas pastime to be bound
    Within the Sonnet’s scanty plot of ground;
    Pleased if some Souls (for such there needs must be)
    Who have felt the weight of too much liberty,
    Should find brief solace there, as I have found.

  • @kamertonaudiophileplayer847
    @kamertonaudiophileplayer847 7 днів тому

    As I learned Option and Result, Rust became easy.

  • @toby9999
    @toby9999 Місяць тому

    I'm thinking that just about any language would seem great after struggling with java. That said, I don't like either language. They both burn my brain cells but in very different ways.

  • @PanopticMotion
    @PanopticMotion 26 днів тому

    I love Rust! I started programming a few months ago and initially tried learning Python, but it didn’t click for me. Rust, on the other hand, feels so straightforward-everything just falls into place. I also really appreciate the lack of traditional object-oriented programming :)

  • @zn4a-pd1jt
    @zn4a-pd1jt 10 днів тому

    i mean as a Java dev almost anything is upgrade at that point.

  • @Shivansh_singh4539
    @Shivansh_singh4539 Місяць тому +1

    Hi Sir,
    I noticed that you’ve been uploading fewer Shorts on your channel lately. As someone who also works in social media, I believe Shorts are an essential tool for growth in today’s creator landscape. Almost everyone is leveraging Shorts to expand their audience.
    I can assist you by editing engaging Shorts from your long-form videos to help boost your reach and engagement. Let me know if you’d like me to contribute!

  • @anon_y_mousse
    @anon_y_mousse Місяць тому +2

    I would suggest that you learn C instead. The compiler doesn't hold your hand, but if you really need that at this point in your career, there are plenty of tools to use. Personally, the more I learn of Rust, the more I hate it. Things like unbox and clone are as much anti-patterns as move is in C++. The more clear syntax for handling an error return where you're maybe receiving something is to merely test it with: if ( obj ) do_something here(); else do_something_else(); Or if a quick exit on failure would make more sense, and it often does, then: if ( !obj ) { print_error(); return error_code; }; Of course, if you still feel the need to have OO design patterns with language support for them, C++ is still the better choice over Rust, even if r- and l- value references have muddied things up.

    • @glebzenkov396
      @glebzenkov396 28 днів тому

      Quote: "The more clear syntax for handling an error return where you're maybe receiving something is to merely test it with: if ( obj ) do_something here(); else do_something_else(); Or if a quick exit on failure would make more sense, and it often does, then: if ( !obj ) { print_error(); return error_code; }; "
      This is literally how rust error handling works (with a bit different syntax). Check Rust book, chapter "Recoverable Errors with Result"
      Quote: "if you still feel the need to have OO design patterns with language support for them, C++ is still the better choice over Rust".
      I would argue: the only OO feature Rust doesn't support is "inheritance of implementation", which is already often considered as anti-pattern. On the other hand, polymorphism in Rust is much better with "static dispatch" and "dynamic dispatch" using the same Traits system

    • @anon_y_mousse
      @anon_y_mousse 28 днів тому

      @@glebzenkov396 So you say, yet every example I see shows off using match and its convoluted garbage syntax to demonstrate handling errors. I don't even like that syntax for handling enums, but when you've only got two possibilities it's worse. I won't argue for inheritance, but I personally prefer the way that C++ does all the rest over Rust. It has a cleaner syntax that's far more regular. Honestly, I didn't think I could hate a syntax more than C++'s until Rust came about.

    • @RustIsWinning
      @RustIsWinning 27 днів тому

      ​@@anon_y_mousseMy guy is still clueless deluxe lmao. Rust has let-else for this. C++ has cleaner syntax with template hell?? Imagine having to invent the rule of three and five and also concepts. I CANT 😂

    • @anon_y_mousse
      @anon_y_mousse 27 днів тому

      @@RustIsWinning Cleaner in that it's a more regular syntax that's easier to parse for a machine, if not read for a human.

  • @StEvUgnIn
    @StEvUgnIn 28 днів тому

    I don’t see the point of these new verbose languages when the Servo engine doesn’t work in the first place. Servo was supposed to be the new browser engine for Firefox, and is the pillar of the development of the Rust programming language.

    • @RustIsWinning
      @RustIsWinning 27 днів тому

      Who told you this nonsense? Firefox uses several servo components. It's also defintely not the "pillar".

    • @StEvUgnIn
      @StEvUgnIn 27 днів тому

      @@RustIsWinning I was around when they announced that cr*p. It crashes over their own official website. Firefox still uses Gecko.

    • @dark0sv
      @dark0sv 26 днів тому

      @@StEvUgnIn And Gecko uses quite a few components from Servo.

    • @StEvUgnIn
      @StEvUgnIn 26 днів тому

      @@dark0sv Show me the code

    • @dark0sv
      @dark0sv 26 днів тому

      @@StEvUgnIn check out servo/components or gfx/wr directories in gecko-dev repo for example

  • @hasibalfuad9652
    @hasibalfuad9652 Місяць тому +4

    Shouting the primeagen out

    • @pietraderdetective8953
      @pietraderdetective8953 Місяць тому +1

      What happened between Prime and Rust? Genuinely curious..I noticed he colored his hair like Sonic the hedgehog ~ blazingly fast.

    • @laundmo
      @laundmo 13 днів тому +1

      ​@@pietraderdetective8953my impression is that no matter how he rationalizes it, his opinion of Rust is of a interpersonal and emotional nature: iirc there was some drama between him and someone else he thinks is associated with Rust (i don't remember exactly) and that's when he stopped using the language.

    • @pietraderdetective8953
      @pietraderdetective8953 13 днів тому

      @ thanks for the info...yeah I watched more Prime's videos and it's really evident he got a beef with Rust (as a community?)
      well that's unfortunate...Rust is a powerful programming language, but yeah a minority of its community are sometimes too die-hard.

    • @laundmo
      @laundmo 13 днів тому

      @@pietraderdetective8953 i think its not even that hes against the die-hard fans who want to rewrite everything in Rust, i recall there being some specific event with some specific person at the root of this.

  • @raphlow
    @raphlow Місяць тому

    Anything compared to Java is "AWESOME"

  • @perghosh8135
    @perghosh8135 Місяць тому

    Rust = strange syntax and where only std::unique_ptr is allowed if you compare to C++

    • @RustIsWinning
      @RustIsWinning 27 днів тому

      Not true + still better than C++ 😂

    • @dark0sv
      @dark0sv 26 днів тому

      What do you mean? std::unique_ptr is the equivalent to Box.

    • @perghosh8135
      @perghosh8135 26 днів тому

      @@dark0sv No, not a replacement but principle is pointer guarding.

    • @perghosh8135
      @perghosh8135 26 днів тому

      @@RustIsWinning Whats better is subjective ;) I think RUST tries to be something like Python but faster.
      They have rushed the language to much and that is starting to bite them in the ass

    • @dark0sv
      @dark0sv 26 днів тому

      @@perghosh8135 not really, unique_ptr does not track lifetimes

  • @MrNedinator
    @MrNedinator 10 днів тому

    bro is glazing glazing...

  • @codeman99-dev
    @codeman99-dev Місяць тому +2

    Before watching:
    I tried Rust. Tried to solve a problem with WebAssembly (too early). Read the Rust book. Completed the Rustlings project. Did codewars challenges. Wrote a very cool CLI tool.
    Was enjoying it for the most part. Then came Shuttle's Christmas Code Hunt 2023... Doing WebSockets with Rust is awful. Total caca poo poo. The type safety doesn't help you in any way. Which means that it's just in your way at the same time as you're trying to solve a race condition. YUCK.

  • @jesper2455
    @jesper2455 Місяць тому +1

    Funny that you compare Rust as being more strict than Java. I've always seen people thinking that Java is strict, when compared to other languages.

  • @chefnyc
    @chefnyc День тому

    Rust is ugly. They should have taken C++ and deleted unwanted features.

  • @kaleabgen9358
    @kaleabgen9358 Місяць тому +3

    bro i am my first person to comment

  • @WhiteSponge
    @WhiteSponge Місяць тому

    Welcome to memory management and pointers!
    This is why learning languages like C++ before jumping into Rust helps a lot 😂

  • @muharief3885
    @muharief3885 Місяць тому

    As a python engineer, it might be i would go mojo lang rather than rust. For me investing in the new language is expensive, need months even years to master it.

  • @N34R4T0M4T
    @N34R4T0M4T 23 дні тому

    check out Zig

  • @PaulHosler
    @PaulHosler Місяць тому

    now if we can just get you to use neovim...

  • @cccc2740
    @cccc2740 Місяць тому +1

    after having worked with java, go, rust, python, i would say following:
    use java/go or even python if you want to deliver a project worth something, use rust if you want to earn those brownie academic points and to make a youtube video(ofcourse project is never delivered)

    • @Heater-v1.0.0
      @Heater-v1.0.0 Місяць тому

      After having worked with ALGOL, Coral, Ada, C, C++, Pascal, Python, Javascript, Rust. I would say the following:
      If you want to produce robust, reliable and performant code, if you want to minimise tedious debugging effort and all those calls in the night when code in production produces random errors or crashes then use Rust.
      If you just want to churn out slop for a pay cheque, with no regard to reliability or efficiency, and don't mind getting more pay cheques for debugging it and taking service calls later then by all means use any other language.
      Really, your demeaning comments about "brownie academic points" and "projects never delivered" is not only uncalled for but incorrect. Plenty of people and companies are delivering quality product in Rust, more everyday. They are busy doing that rather than making YT videos about it.

  • @AslamNazeerShaikh
    @AslamNazeerShaikh Місяць тому

    C# is best and better than rust in same case 😅🎉❤

  • @HansBezemer
    @HansBezemer Місяць тому

    Rust and Java - nothing to learn here, "Don't recommend channel".

    • @GetRektTom
      @GetRektTom Місяць тому +1

      What?

    • @RustIsWinning
      @RustIsWinning Місяць тому +1

      Okay boomer 😂

    • @HansBezemer
      @HansBezemer Місяць тому

      @RustIsWinning You really have to be a pureblooded Gen Z to think there is a shadow of a chance that this constitutes a valid argument.

    • @RustIsWinning
      @RustIsWinning Місяць тому

      @@HansBezemer I am Gen Z and my argument is so good that it made some random Hansi in the world respond with my name which only tells the truth! Checkmate.

    • @HansBezemer
      @HansBezemer Місяць тому

      @RustIsWinning I'm far from random, pal. And your argument is a certified logical fallacy. It's true what they say about Gen Z. They're really ignorant and lazy.

  • @michelvandermeiren8661
    @michelvandermeiren8661 Місяць тому

    To my xp, it is hard to get Rust as fast as java. You need to put ton's on ingeeniring

  • @megatron324
    @megatron324 Місяць тому

    you are a caricature of real life problems to me, i do not take you seriously at all and have learned nothing from you.