- Видео 98
- Просмотров 326 055
The Dev Method
США
Добавлен 14 янв 2019
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
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...
Deploy free website for blog or code documentation
Просмотров 6032 года назад
Deploy free website for blog or code documentation
Rust: Variables, Data Types, Functions
Просмотров 1,5 тыс.2 года назад
Rust: Variables, Data Types, Functions
Rust: Intro and setting up your first project
Просмотров 6 тыс.2 года назад
Rust: Intro and setting up your first project
Hi, love your editor. What colorscheme do you use?
Oh my goodness, my hero is back!
I really appreciate your content, but I always here "welcome to the death method" 😕
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.
tysm!
you are great
Great video. Thanks
watch curl ... ?
He’s back!
I don’t think ratatui has that grouping feature, nice!
Long time no see. What’s up with the general lack of new Rust videos on YT in 2024?
I think 2024 has been a lot of zig hype, I’m still with Rust though
EuroRust 2024 was last week, maybe the talks will land on RUclips some time.
Great!!!
That was very helpful😊😊!!!
That was very helpful😊😊!!!
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.
This is lifted straight from the Rust book unfortunately. I was looking for a different take to reinforce my learning.
every top rust video is its ridiculous
Unfortunately, I have a problem with the blurred effect, i got like three layers of overlapping pixels
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?
Crate "anyhow" is widely used to simplify Result typing. Check it out everyone.
Please make more videos again!
Keep going! This is awesome!
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.
good video, but for my dev level it's waste of time :(
U is also the next letter in the alphabet after T
I like your tutorials, straight to the point yet easy to follow 👍
13:30 swift?
It's much clear in C, but funnier in Rust.
So basically, this is somewhat similar to a solution in Visual Studio in C# for example?
What font do you use? Very nice.
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?
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.
bro, so how does it work. lol
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
Very helpful, thanks a lot!!
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)
Game dev is hard
this is the same video as "Let's Get Rusty" channel
Functional programming my man
Mutex in Rest are "Bizarre" Weird... they lock nothing at all !!! In my code, so back to C programming !!
global ass variable
Thanks.. 👍
The best explanation for something that everybody assumes you might understand, but can be quite tricky. THANK YOU!^.^
thanks!
What theme you using?
Please, continue your lessons, it's very helpful
T stands for c++ Template, haha. The first example is one step away from a linear sort.
simple and effective. Thanks!
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.
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!
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...
you look at your keyboard while typing 🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣