The Dev Method
The Dev Method
  • Видео 98
  • Просмотров 326 055
Rust Project: poll
#rust #project #workspace
This is a small example project I made to demonstrate a couple things we have covered in my previous videos. The GitHub repository is located here github.com/rickypowell/poll.
00:00 intro
01:10 btop
01:50 intro to poll
02:51 poll arguments
04:11 look at script
06:47 rust project
07:14 root Cargo.toml
07:48 looking at the crates
08:02 adding another crate
08:44 building all crates
09:50 look at the code
10:54 first couple lines
13:24 main loop
14:45 how to use poll
16:22 pretty-print crate
17:43 configuration rows formatting
18:16 using generics
21:10 using a function from pretty-print
23:39 adding the padding
25:44 Stylized text
26:00 toughest part
26:55 Copilot helps me out
Просмотров: 1 800

Видео

Rust: Starting a Workspace
Просмотров 8 тыс.Год назад
Make a workspace to create multiple Rust crates that share code between them or focus on creating a mono-repo of Rust packages. The crate can depend on one another or be entirely separate from each other.
Rust: Shared-State Concurrency
Просмотров 14 тыс.Год назад
#rust #threads #mutex Instead of passing messages to and from threads, you can also have multiple threads access shared data. Shared memory concurrency is like multiple ownership. Links Chapter 16 Section 3 doc.rust-lang.org/book/ch16-03-shared-state.html
Rust: Send Data between Threads
Просмотров 11 тыс.Год назад
#rust #thread #data Threads or actors communicate with one another by sending messages containing data The Rust Standard Library provides an implentation of Channels. A Channel is concept where one thread sends data to another thread. Links The Rust Programming Book Chapter 16 Section 2 doc.rust-lang.org/book/ch16-02-message-passing.html
Rust: Spawn a Thread
Просмотров 3 тыс.Год назад
#rust #thread #spawn Programming in multi-threaded environment is challenging and error prone. Rust has some utilities to help us with this. You can fix your concurrent code has you are working on it before running it. This take on concurrently programming is called “Fearless Concurrency”. Links Chapter 16 Section 1 doc.rust-lang.org/book/ch16-01-threads.html
Rust: Weak References
Просмотров 4,2 тыс.Год назад
#rust #weak #cycles It’s possible to allocate memory in Rust that never get’s cleaned up. This is a memory leak. Items that refer to each other create cycles. This means that neither item that references the other will ever reach a reference count of 0, and, therefore, never be dropped. 0:00 Intro 0:33 Creating a Reference Cycle 7:21 Preventing Reference Cycles: Turning an Rc into a Weak 8:36 R...
Rust: RefCell
Просмотров 8 тыс.Год назад
#rust #refcell #interiormutability Interior Mutability - Mutate the data even with immutable references to that data. The borrowing rules disallow this in Rust. RefCell follows this Interior Mutability Pattern. 0:00 intro 1:16 Enforcing Borrowing Rules at Runtime with RefCell 4:25 Interior Mutability: A Mutable Borrow to an Immutable Value 5:01 A Use Case for Interior Mutability: Mock Objects 9...
Rust: Reference Counted Smart Pointer
Просмотров 2 тыс.2 года назад
In Rust ownership you have a simple case where there is only ever one owner of a variable. However, there can be times where you need multiple owners to one value. In Rust, you can enable multiple owners by using the Rc type. This stands for Reference Counting. 0:00 intro 1:07 Using Rc to Share Data 3:13 Cloning an Rc Increases the Reference Count
Rust: Drop Trait
Просмотров 3,3 тыс.2 года назад
Running some code on cleanup. When your variable is removed from scope, then the drop function is called on it. This is inserted by Rust. Implementing the drop method yourself allows you to customize the cleanup code that needs to run when this instance goes out of scope. You can use this implementation to release resources like files or network connections. #rust #drop #cleanup 0:00 intro 0:32...
Rust: Deref Trait
Просмотров 8 тыс.2 года назад
#rust #traits #dereference The Deref trait provides Rust with the info it needs to customize the deference * operator for you custom data types. 0:00 intro 1:14 Following the Pointer to the Value 4:16 Using Box Like a Reference 5:26 Defining Our Own Smart Pointer 6:37 Treating a Type Like a Reference by Implementing the Deref Trait 8:44 Implicit Deref Coercions with Functions and Methods 12:32 ...
Rust: Store Data on the Heap with Box
Просмотров 6 тыс.2 года назад
#rust #smart #box ! At 1:08, I said "Defer Trait", but I actually mean "Deref Trait" Box is a straightforward example of one Smart Pointer in Rust. Box allows you to store data on the heap instead of the stack. Instead of passing around your data, and copying it’s total memory on the stack, you can use a Box to store the data and avoid the memory copies on the stack and defer to pointer copies ...
Rust: Iterators
Просмотров 16 тыс.2 года назад
#rust #functional #map Iterators are one of my favorite parts of Rust. Let's learn about them here as they are discussed in Chapter 13 section 2 of the Rust Programming book 0:00 intro 0:34 Processing a Series of Items with Iterators 5:11 The Iterator trait and the next method 9:27 Methods that consume the iterator 10:17 Methods that produce other Iterators 17:02 Using Closures that Capture the...
Rust: Closures
Просмотров 17 тыс.2 года назад
Rust: Closures
Rust: Automated Testing
Просмотров 6 тыс.2 года назад
Rust: Automated Testing
Rust: Generics, Traits, Lifetimes
Просмотров 51 тыс.2 года назад
Rust: Generics, Traits, Lifetimes
Rust: Error Handling
Просмотров 16 тыс.2 года назад
Rust: Error Handling
Deploy free website for blog or code documentation
Просмотров 6032 года назад
Deploy free website for blog or code documentation
Rust: HashMap
Просмотров 4,7 тыс.2 года назад
Rust: HashMap
Rust: String
Просмотров 2,1 тыс.2 года назад
Rust: String
Rust: Vectors
Просмотров 5 тыс.2 года назад
Rust: Vectors
Rust: Managing a Growing Project
Просмотров 18 тыс.2 года назад
Rust: Managing a Growing Project
Rust: Programming a Pitfall Game
Просмотров 1,7 тыс.2 года назад
Rust: Programming a Pitfall Game
Rust: Enums and Option
Просмотров 1,7 тыс.2 года назад
Rust: Enums and Option
Rust: Structs
Просмотров 1,5 тыс.2 года назад
Rust: Structs
Rust: Slice Types
Просмотров 7 тыс.2 года назад
Rust: Slice Types
Rust: Ownership and Borrowing
Просмотров 2,9 тыс.2 года назад
Rust: Ownership and Borrowing
Rust: Control Flow
Просмотров 1,3 тыс.2 года назад
Rust: Control Flow
Rust: Variables, Data Types, Functions
Просмотров 1,5 тыс.2 года назад
Rust: Variables, Data Types, Functions
Rust: Programming a Guessing Game
Просмотров 2,3 тыс.2 года назад
Rust: Programming a Guessing Game
Rust: Intro and setting up your first project
Просмотров 6 тыс.2 года назад
Rust: Intro and setting up your first project

Комментарии

  • @pad8941
    @pad8941 9 дней назад

    Hi, love your editor. What colorscheme do you use?

  • @sehbiii
    @sehbiii Месяц назад

    Oh my goodness, my hero is back!

  • @flippert0
    @flippert0 Месяц назад

    I really appreciate your content, but I always here "welcome to the death method" 😕

  • @luckystrike91
    @luckystrike91 Месяц назад

    24:54 you can use this instead: format!("{:>width$}", item.label.to_string(), width = max_label.lable.len()); as far as i know it don't allocate string, but " ".repeat(n) do.

  • @thronplo
    @thronplo Месяц назад

    tysm!

  • @thronplo
    @thronplo Месяц назад

    you are great

  • @miriamramstudio3982
    @miriamramstudio3982 Месяц назад

    Great video. Thanks

  • @petoknm
    @petoknm Месяц назад

    watch curl ... ?

  • @recs8564
    @recs8564 Месяц назад

    He’s back!

  • @shapedthought
    @shapedthought Месяц назад

    I don’t think ratatui has that grouping feature, nice!

  • @raidensama1511
    @raidensama1511 Месяц назад

    Long time no see. What’s up with the general lack of new Rust videos on YT in 2024?

    • @shapedthought
      @shapedthought Месяц назад

      I think 2024 has been a lot of zig hype, I’m still with Rust though

    • @user-zz6fk8bc8u
      @user-zz6fk8bc8u Месяц назад

      EuroRust 2024 was last week, maybe the talks will land on RUclips some time.

  • @AbelFikadu-lt1ei
    @AbelFikadu-lt1ei 2 месяца назад

    Great!!!

  • @AbelFikadu-lt1ei
    @AbelFikadu-lt1ei 2 месяца назад

    That was very helpful😊😊!!!

  • @AbelFikadu-lt1ei
    @AbelFikadu-lt1ei 2 месяца назад

    That was very helpful😊😊!!!

  • @Zambieslar
    @Zambieslar 3 месяца назад

    The angle bracket appended to the end of a function is a lifetime definition, not a type definition. That's how you can assign a lifetime to a function and its nested variables.

  • @oakwizard9391
    @oakwizard9391 3 месяца назад

    This is lifted straight from the Rust book unfortunately. I was looking for a different take to reinforce my learning.

    • @osgiliath_burns
      @osgiliath_burns 3 месяца назад

      every top rust video is its ridiculous

  • @keyproco
    @keyproco 3 месяца назад

    Unfortunately, I have a problem with the blurred effect, i got like three layers of overlapping pixels

  • @dubfather521
    @dubfather521 3 месяца назад

    I dont under stand, when you spawn 10 threads, they all try to get the lock at the same time wouldn't the output only be 1? How are the threads all getting the lock/waiting?

  • @langnostic5157
    @langnostic5157 3 месяца назад

    Crate "anyhow" is widely used to simplify Result typing. Check it out everyone.

  • @DSaad
    @DSaad 4 месяца назад

    Please make more videos again!

  • @batcat9k
    @batcat9k 4 месяца назад

    Keep going! This is awesome!

  • @matthewsorg656
    @matthewsorg656 4 месяца назад

    At 19:30, why do you need to move the let mut guess inside the loop? Shouldn't the io.stdin().readline(&mut guess) be reassigning guess? It's unclear to me why you need to reallocate guess every loop.

  • @Timon460
    @Timon460 4 месяца назад

    good video, but for my dev level it's waste of time :(

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

    U is also the next letter in the alphabet after T

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

    I like your tutorials, straight to the point yet easy to follow 👍

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

    13:30 swift?

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

    It's much clear in C, but funnier in Rust.

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

    So basically, this is somewhat similar to a solution in Visual Studio in C# for example?

  • @rsalmei
    @rsalmei 6 месяцев назад

    What font do you use? Very nice.

  • @Christobanistan
    @Christobanistan 6 месяцев назад

    So why would RefCell be unsafe if it's implemented by the Rust devs? The entire compiler could have bugs that make Rust code fail, so why not give RefCell the same guarantee and call it a safe intrinsic?

  • @bbkr2063
    @bbkr2063 6 месяцев назад

    When reaching Box lesson I got epiphany that String is just Box::new("foo"). While not being exactly correct (String object is more feature rich than slice) it helped me to understand why compiler is not complaining about struct size when I define "Struct{ x: String }". Somehow suddenly this heap/stack concept "clicked" in my mind.

  • @mid4084
    @mid4084 6 месяцев назад

    bro, so how does it work. lol

  • @meyou118
    @meyou118 6 месяцев назад

    ty - it appears the key to the error for collect is "...because all candidates have the same return type" - imho; the compiler should list them and thats why underscore can be used, the compiler already knew the type of the items. - anyway thx, i just learned something about rust

  • @flyosity
    @flyosity 6 месяцев назад

    Very helpful, thanks a lot!!

  • @futotta-neko
    @futotta-neko 7 месяцев назад

    I was tasked to write a simple game that uses TCP, now im learning multi threading. How the hell did i get here? 😅 (Its my first week writing Rust)

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

    this is the same video as "Let's Get Rusty" channel

  • @IamAWESOME3980
    @IamAWESOME3980 8 месяцев назад

    Functional programming my man

  • @truehurukan
    @truehurukan 8 месяцев назад

    Mutex in Rest are "Bizarre" Weird... they lock nothing at all !!! In my code, so back to C programming !!

  • @sunofabeach9424
    @sunofabeach9424 8 месяцев назад

    global ass variable

  • @ravidborse
    @ravidborse 8 месяцев назад

    Thanks.. 👍

  • @shadowcharly
    @shadowcharly 8 месяцев назад

    The best explanation for something that everybody assumes you might understand, but can be quite tricky. THANK YOU!^.^

  • @pixl_xip
    @pixl_xip 8 месяцев назад

    thanks!

  • @jlambert12013
    @jlambert12013 9 месяцев назад

    What theme you using?

  • @sobl1403
    @sobl1403 9 месяцев назад

    Please, continue your lessons, it's very helpful

  • @overclucker
    @overclucker 9 месяцев назад

    T stands for c++ Template, haha. The first example is one step away from a linear sort.

  • @TravisDumont-hq9ix
    @TravisDumont-hq9ix 9 месяцев назад

    simple and effective. Thanks!

  • @fonkengfelix134
    @fonkengfelix134 9 месяцев назад

    Great video there...Just a quick question !!! Let’s say you have your web application src in gitlab and you would like end users to access this webApp. How would you use docusaurus to realise this? I am pretty much new to docusaurus.

  • @maf909
    @maf909 9 месяцев назад

    Hello there, I was recently added a cpp addon on my existing app and the thing is it won't able to run on production. but, it works fine on production. do you have any idea??? its urgent! Thank you in advance!

  • @glener1000
    @glener1000 9 месяцев назад

    In my project I had to keep everything inside the "src" folder, without any more nesting. Because when there were more nests, the local code worked normally, but in my github actions jobs it gave an error that didn't find the imports...

  • @i007c
    @i007c 10 месяцев назад

    you look at your keyboard while typing 🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣