Rust Functions and Modules 🦀

Ғылым және технология

In this video, we take a look at defining Rust functions with input parameters and output values. We also will explore how to organize Rust code into modules and child modules. Each member of a Rust module has private or public visibility; by default it's private. In order for a function to be exposed from a Rust module, you will need to specify public visibility. Rust modules can be defined in separate source code files and referenced from your main (entrypoint) module. Although the Rust compiler (rustc) can only accept a single source code file as input, any referenced module files will be included during the compilation step.
🤯 Rust Programming Playlist 🦀 • Rust Programming Tutor...
📖 Rust Modules: doc.rust-lang.org/reference/i...
📖 Rust Functions: doc.rust-lang.org/reference/i...
Visual Studio Code ➡️ code.visualstudio.com
Rust Website ➡️ rust-lang.org
Rustup Installer ➡️ rustup.rs
Rust Docs ➡️ doc.rust-lang.org/book
Please follow me on these other social channels!
➡️ trevorsullivan.net
➡️ github.com/pcgeek86
➡️ / pcgeek86
➡️ / trevorsullivan
➡️ / trevorsoftware
➡️ tiktok.com/pcgeek86
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.
#opensource #software #linux #devops #programming #rusty #rustdev #dev #coding #codinglife #code #coder #ubuntu #ubuntulinux #appdev #rustlang #rust #developer

Пікірлер: 37

  • @TrevorSullivan
    @TrevorSullivan10 ай бұрын

    🦀🦀🦀 Rust Programming Tutorial Playlist 🦀🦀🦀 kzread.info/head/PLDbRgZ0OOEpUkWDGqp91ODn0dk7LPBAUL 🖥🖥🖥 LXD Virtualization on Linux Playlist 🖥🖥🖥 kzread.info/head/PLDbRgZ0OOEpX_uqK_hAq98ltdc4DP-D34

  • @Exidiful
    @Exidiful8 ай бұрын

    I just started following your series and Im telling you man.. finally, Im understanding and learning rust. Love how you always explain why and ask questions that make us think. Because of you I will finally be able to tell people "I use rust btw" Really appreciate this ❤

  • @osmanovitch7710
    @osmanovitch77103 ай бұрын

    finally , someone explains RUST verry well

  • @Amir-bd4uk
    @Amir-bd4uk2 ай бұрын

    Thank you for making this series. I'm watching your videos to get started with Rust and i really appreciate how clearly you explain everything.

  • @ImranKhan-br5dv
    @ImranKhan-br5dv2 ай бұрын

    your channels teach us just as the Hitesh sir , an indian teacher .

  • @jasonbraithwaite9204
    @jasonbraithwaite9204Ай бұрын

    Superb, well explained and easy to understand. Thank you Trevor :)

  • @kasugaryuichi9767
    @kasugaryuichi976710 ай бұрын

    Thank you so much for making these!

  • @karthikpuvvula
    @karthikpuvvula2 ай бұрын

    This is the best Rust tutorial on YT. I tried a lot of famous channels but your explanation style and depth is simply awesome. Thank you!

  • @TrevorSullivan

    @TrevorSullivan

    2 ай бұрын

    Thank you for your kind comment, Karthik! I am so happy to hear that you're learning from my channel. Enjoy using Rust to build applications! 🦀

  • @amirerfanian4418
    @amirerfanian44185 ай бұрын

    Hello Trevor , thank you SO much for your time , your explanation is exceptional man ! where were you so far ?! you are amazing teacher ! thank you again for your time and efforts

  • @AryungChen
    @AryungChen7 ай бұрын

    Easy to understand !! awesome

  • @terraflops
    @terraflops4 ай бұрын

    i am new to Rust and having a hard time with it, i found your video on the side panel of KZread (my issue was with importing modules), hoping to learn from you and have more positive experience with Rust. (new subscriber)

  • @ashisharya65
    @ashisharya6510 ай бұрын

    Another great video Trevor. I have been watching your videos since the day I started learning PowerShell and now learning Rust using this amazing playlist. Thanks a lot for this. 😊

  • @TrevorSullivan

    @TrevorSullivan

    10 ай бұрын

    I'm glad you're enjoying Rust as well, Ashish!! It's more complex but very good knowledge to have! Just think what you'll be able to do with it a year from now! 🦀🦀

  • @ashisharya65

    @ashisharya65

    10 ай бұрын

    @@TrevorSullivan : I have a question, is Rust a good programming language to be used in cloud (Azure/AWS) development at this moment?

  • @TrevorSullivan

    @TrevorSullivan

    10 ай бұрын

    @@ashisharya65 good question!! I'm not sure what the maturity of the AWS or Azure SDKs for Rust looks like. I'll eventually be taking a look at them! 🦀

  • @Ehmiiz
    @Ehmiiz8 ай бұрын

    Love this series!

  • @TrevorSullivan

    @TrevorSullivan

    8 ай бұрын

    Thank you so much! I am glad you are benefitting from it! Rust on 🦀

  • @subhamprasad1373
    @subhamprasad13738 ай бұрын

    Thank you 🎉

  • @anjonsarker2374
    @anjonsarker237410 ай бұрын

    Outstanding

  • @RadicalInteger
    @RadicalInteger8 күн бұрын

    nice video!

  • @symshark
    @symshark9 ай бұрын

    Hello Trevor, I am working through the book The Rust Programming Language, 2nd Edition but your videos do provide more clarity and are really helping me out through my rust programming journey. I was just curious if there is a reason for using the return statement instead of just using an expression to return the value of the function? is it based on preference?Thank you for all your help and I hope you keep creating more rust programming videos.

  • @TrevorSullivan

    @TrevorSullivan

    9 ай бұрын

    Hello @symshark, and thanks for your supportive comment! To answer your question, yes, I use the "return" keyword because it's more explicit than simply specifying an expression without the semi-colon. Of course it's valid to use either approach, so feel free to use the one that suits you best! For people who are new to Rust programming, I think using the return keyword is easier to visualize, when scanning some code samples. 🙂 I will be publishing more Rust programming videos! 🦀Rust on!!!

  • @symshark

    @symshark

    9 ай бұрын

    @@TrevorSullivan That makes sense, thank you!

  • @drac8854
    @drac88547 ай бұрын

    Hi I have a suggestion But before that i wanted to let you know that i have not yet watched/followed your rust Playlist i have it saved but i am procrastinating 😅 (Sorry) In my opinion a great way to teach rust would be to create some software/application. And showcasing it in the start. For me it sets a goal in my mind as yes i have to create this thats why i have to watch next video to understand. Surly it doesn't have to be a big software for start up we could start with just todo app or even a basic app that convert number to words. As long as i am motivated to build that thing i'll learn rust. (I hope i am making sense) I found your video because i was trying to convert one typescript code to rust and i was confused... But that project went to dump because i dont know some cycle error.....

  • @TrevorSullivan

    @TrevorSullivan

    7 ай бұрын

    Yes, I agree that example driven training can be helpful. However, people often need to know how to do a very specific thing in Rust. That's why the foundational learning is important in addition to building sample applications! One isn't necessarily better than the other, they're just different learning styles for people at different stages of their learning progression. Good feedback to keep in mind though! Thank you!

  • @adityakiran2956
    @adityakiran295614 күн бұрын

    Awesome video!!! really learnt a lot, gave up came to YT after failing to understand docs Can anyone tell me what theme and extension is being used for Rust?

  • @TrevorSullivan

    @TrevorSullivan

    14 күн бұрын

    Thank you for your kind words! The theme is "outrun" by "samrapdev" and the extension is Rust Analyzer.

  • @ThisGuyDakota
    @ThisGuyDakota10 ай бұрын

    I'm self-taught in powershell and python and a little lacking in my understanding of the heap/stack (and why to do things with them in mind). So kind of wondering why we've been using &str (string pointers) all this time instead of a regular String? Is it just to utilize the performance that Rust is known for, since the &str is just borrowing a value, and (I'm assuming) String creates a dedicated spot in memory?

  • @TrevorSullivan

    @TrevorSullivan

    10 ай бұрын

    Great question, and something that I've been seeking to understand better (beyond just Rust) for YEARS. In the Rust by Example book, they talk a little bit about this: doc.rust-lang.org/rust-by-example/std/box.html Quote: "All values in Rust are stack allocated by default. Values can be boxed (allocated on the heap) by creating a Box. " If we look at the article, in the same book, covering Rust Strings (capital S), we can see that: "String is heap allocated, growable and not null terminated." The difference with static strings (&str) is that they point to a stack-allocated value with a KNOWN length, whereas the String type is resizable on the heap. Link: doc.rust-lang.org/rust-by-example/std/str.html Hope that helps? 🙂

  • @ThisGuyDakota

    @ThisGuyDakota

    10 ай бұрын

    @TrevorSullivan Still a bit fuzzy, but that's a great deal of info that'll probably point me in the right direction so thanks, much appreciated!

  • @ERAYKAAN850
    @ERAYKAAN8509 ай бұрын

    Can you show modules more in depth? I mean like creating folders, files in it and more. You just showed how to create files and use them. But nice video!

  • @TrevorSullivan

    @TrevorSullivan

    9 ай бұрын

    Thanks for the idea! One of the upcoming topics will be crates, which will allow you to organize your code into libraries. I'll see if I can go into more depth on modules as well.

  • @subhamprasad1373
    @subhamprasad13738 ай бұрын

    Why was the binary 4 mb in size ??

  • @TrevorSullivan

    @TrevorSullivan

    8 ай бұрын

    Probably because I compiled it in debug mode, not release mode.

  • @subhamprasad1373

    @subhamprasad1373

    8 ай бұрын

    @@TrevorSullivan thanks for your quick reply 👏, really you have done amazing job 💯 in your videos

  • @TrevorSullivan

    @TrevorSullivan

    8 ай бұрын

    @@subhamprasad1373 thanks so much for your kind feedback! 🙂

Келесі