Implement Methods on Rust Structs 🦀

Поделиться
HTML-код
  • Опубликовано: 8 фев 2025
  • Rust developers can implement behaviors on their custom data structures by using methods. Methods are simply Rust functions that operate on a type (aka. static methods) or an instance of a type (instance methods). In this video, we'll look at some practical examples of implementing Rust methods on a "Vehicle" and "Person" structs.
    🤯 Rust Programming Playlist 🦀 • Rust Programming Tutor...
    📖 Rust Struct Methods: doc.rust-lang....
    Visual Studio Code ➡️ code.visualstu...
    Rust Website ➡️ rust-lang.org
    Rustup Installer ➡️ rustup.rs
    Rust Docs ➡️ doc.rust-lang....
    Please follow me on these other social channels!
    ➡️ trevorsullivan...
    ➡️ github.com/pcg...
    ➡️ / pcgeek86
    ➡️ / trevorsullivan
    ➡️ / trevorsoftware
    ➡️ tiktok.com/pcg...
    All trademarks, logos and brand names are the property of their respective owners. All company, product and service names used in this website are for identification purposes only. Use of these names,trademarks and brands does not imply endorsement.
    #rustlang #rust #rustdev #opensource #software #linux #devops #programming #rusty #dev #coding #codinglife #code #coder #ubuntu #ubuntulinux #appdev #developer

Комментарии • 22

  • @TrevorSullivan
    @TrevorSullivan  Год назад

    Check out the FULL Rust video playlist! 🦀 ruclips.net/p/PLDbRgZ0OOEpUkWDGqp91ODn0dk7LPBAUL

  • @ExidifulCrypto
    @ExidifulCrypto Год назад +4

    i dont even know how im keeping up, my only explanation, my teacher is awesome. Thanks brother, I can tell you just because of how good you explained rust, I will be a permanent fan for every series you have on your channel

    • @TrevorSullivan
      @TrevorSullivan  Год назад +1

      Just keep learning a little bit each day! That's how it's done. 🦀

    • @rendivs
      @rendivs 5 месяцев назад

      other tutorial seems make it more complicated, i like this, super easy to understand

  • @ojoawojoshua780
    @ojoawojoshua780 6 месяцев назад +1

    The create_vehicle inside the impl fuction which returns "Vehicle" can also return "Self" which points to Vehicle because it's in an impl of Vehicle

  • @princemarkied8071
    @princemarkied8071 Год назад +4

    I will never be smart enough to use this, but I can dream.

    • @TrevorSullivan
      @TrevorSullivan  Год назад +1

      You are capable of it!! What's holding you back? Try it yourself!

    • @minkus-moinkus
      @minkus-moinkus 11 месяцев назад

      u got it brudda

  • @gautamjh
    @gautamjh Год назад

    Nicely explained

  • @OmbasaMukhwami
    @OmbasaMukhwami 9 месяцев назад +2

    How dare you make rush so easy 😂😂

  • @cbbcbb6803
    @cbbcbb6803 7 месяцев назад

    I will try this.

  • @sulaimonakande8611
    @sulaimonakande8611 7 месяцев назад

    Your explanations are top-notch. Thanks.
    what project can i start building at this level

    • @TrevorSullivan
      @TrevorSullivan  7 месяцев назад

      Thanks! I'm glad you're learning from these videos. A good start would be a CLI tool.

    • @sulaimonakande8611
      @sulaimonakande8611 7 месяцев назад

      Ok thanks

  • @pipi_delina
    @pipi_delina Год назад

    Do you have plans to do something on Golang as well

    • @TrevorSullivan
      @TrevorSullivan  Год назад

      Great question. It is on my radar, but in the short term, I'm investing in Rust. Are you planning to use Golang, or currently are?

    • @pipi_delina
      @pipi_delina Год назад

      @@TrevorSullivan I have been split between the two.. I most default to python. I see them both as similar but will be great to be able to understand them all

    • @TrevorSullivan
      @TrevorSullivan  Год назад +1

      @@pipi_delina 💯 you are on the right track! Never limit yourself to just one technology stack! I used to do that earlier in my career, but now I just use what's best or interesting!

  • @gamehacker5692
    @gamehacker5692 5 месяцев назад

    So Java is basically C# and Rust is basically C++ lmao

    • @TrevorSullivan
      @TrevorSullivan  5 месяцев назад

      Rust is actually just about as fast as C++ applications! Check out some benchmarks out there.

    • @harshjain3122
      @harshjain3122 5 месяцев назад

      More like...Rust is closer to C and Haskell is closer to C++

    • @gamehacker5692
      @gamehacker5692 5 месяцев назад

      @@harshjain3122 I haven’t taught myself C or Haskell yet but I get the jist since Java and c# are always compared (c# is biter imo but that’s bc I use unity lol)