1:06:00 The way you explained the string. I am your fan now. Will love to watch a more real-world stream rust use case scenario. How about stream on FFI, take python for an instance using rust binary to handle excel sheet parsing or what not! It will definitely help clear up the concept of using rust properly. or Embedded, SoC use case stuff as well. What made me stop the recorded stream in between and come here comment was, the way you are taking everyone's query between stream, and on the basis of importance you take enough time to clear the doubt of the viewer. That was just heartfelt. Keep doing this. PS:- I read 10 chapters of the rust book it definitely helped to get familiar with the basic concepts.
Really happy to hear 😊 I'm glad that I could help flatten the Rust learning curve just a bit for you. I'm always looking for new topics and I'll make sure to add those to the list. Unfortunately I'm mostly experience with web development (mainly backend). Thats why I'm currently doing a series where I build a Twitter clone from scratch. The videos of that are also on this channel in case you're interested. I have very little experience with embedded stuff and only with Ruby+Rust, not Python. Parsing in general is something I would like to dive more into. Processing large amounts of data sounds like a good fit for Rust. Let me know if you have any other questions you want me to cover. You're also welcome to join the live streams on twitch.tv/davidpdrsn and ask questions during the stream.
39:10 Actually stdin can and will run out of input when it is closed and/or reads EOF (end-of-file). This can happen for example when the input is piped into the program or if you press Ctrl-D on the terminal (which will send EOF). If you unwrap on the iterator this will cause a panic. I use Ctrl-D all the time to exit interactive CLI tools. There is also another use for Ctrl-D in non-raw mode: If you enter some text before pressing Ctrl-D it will not send EOF but instead flush the terminal buffer and pass the entered text to the application similar to entering a newline (but without the newline character at the end).
Oh yeah thats true. I didn't consider stdin being something else than the keyboard. Makes sense! I guess this bit will then go into an infinite loop if there is no more input left github.com/davidpdrsn/delete-git-branches/blob/master/src/main.rs#L107 🤔 Should probably fix that if it is the case.
Great stream. Definitely learned some good tricks. At 2:28:24 I think you could have actually used filter_map, but you were returning Result whereas filter_map should output Option, so by returning Option I think it would have compiled. Also if you delete the last branch in the loop you don't get a chance to undo with your current implementation, do you? Again thanks for a great stream from a fellow Dane :)
Possibly, but I'm not sure we'd easily be able to use `?` within filter_map 🤔 And yes that is totally true, you cannot undo deleting the last branch. Didn't consider that case. PRs are welcome 😜 🇩🇰✌️
The reason you couldn’t delete master is that it was the branch you currently had checked out. The right thing to do there was to check whether the branch equaled repo.head().
In theory yes, but in practice no. First of all the rust compiler (or llvm) might optimise away the recursion and just make a loop instead otherwise you would have to undo more times than you have stack space. I think it would be premature optimisation to worry too much about it.
Thanks for explaining the '?' operator! I was wondering the same thing about using '?' on different error types and you explained it perfectly! This explanation starts at 31:00 for anyone interested.
Hi, nice video! What would be the best way to list all branches as a list menu so the user can select specific branch with the arrow keys, any library recommendation?
Thanks for the tutorial! I'm also curious about your setup...what are you using to run rust-analyzer? I use coc.nvim but it doesn't look quite the same. Also, are you using tmux? I like your statusbar.
I use github.com/prabirshrestha/vim-lsp. Tried coc but didn't like all the javascript stuff that it required. I'm very happy with vim-lsp. And yes I'm running nvim inside tmux. You can find all my config here github.com/davidpdrsn/dotfiles
Hi @@davidpedersen2649, I'm also enjoying your session very much. I was also much interested in your (n)vim setup as it looks much more responsive from what I use (coc-rust-analyzer). In particular having diagnostics updated while you type look really useful, and light years from the "save to update" behavior of rust-analyzer with CoC. I checked your dot files and it seems now you are using exactly that. AFAIK I was wondering if you just sacrificed responsiveness for other features (better diagnostics?) or if you find a way to make coc-rust-analyzer near the responsiveness of what you had before. Thanks!
No I didn’t do anything special to make it faster. Sounds weird that you’re having issues. Perhaps try opening an issue on either coc or rust-analyzer.
@@davidpedersen2649 strange, from all I read it is a know issue that rust analyzer can't update on the fly and you have to save to "refresh" and get the current errror. There is already one issue and it is marked as a task to make rust-analyzer the default LSP for rust: github.com/rust-analyzer/rust-analyzer/issues/6591, github.com/rust-analyzer/rust-analyzer/issues/4224. From my searches I also seen people mentioning this as a know issue (for example: www.reddit.com/r/neovim/comments/j5fev9/coc_lint_on_rust_files_only_updates_after_saving/). I couldn't find a way to make it update on the fly while I type like it happens to you in the video. Is it really working for you? Thanks!
Not quite sure I follow you. What you’re seeing in the video is what I’m experiencing 😅 I get completions while typing and it checks for errors when I save.
I neovim with rust-analyzer and github.com/prabirshrestha/vim-lsp. You can find my config here github.com/davidpdrsn/dotfiles. I'm also running tmux to split the screen and stuff. The comment plugin I use is github.com/tpope/vim-commentary
@@davidpedersen2649 does vim-lsp provide the facility for displaying the errors and warning in-line with code? or are you using a separate plugin for that? I am sorry, if this is commonplace knowledge...
@@davidpedersen2649 I use the same however I have to move the cursor to the error indication location to view the warning/error text. Anyways, thank you creating this gem of a stream! In case you decide to do another stream in the future, can you please work on creating a utility which requires some sort of client-server stuff, wherein the server is a daemon on the same machine...
The demonstration of thiserror was great!
Fantastic stream. You’re a great educator! I hope you get the time for more of those!
1:06:00 The way you explained the string. I am your fan now. Will love to watch a more real-world stream rust use case scenario. How about stream on FFI, take python for an instance using rust binary to handle excel sheet parsing or what not! It will definitely help clear up the concept of using rust properly. or Embedded, SoC use case stuff as well.
What made me stop the recorded stream in between and come here comment was, the way you are taking everyone's query between stream, and on the basis of importance you take enough time to clear the doubt of the viewer. That was just heartfelt. Keep doing this.
PS:- I read 10 chapters of the rust book it definitely helped to get familiar with the basic concepts.
Really happy to hear 😊 I'm glad that I could help flatten the Rust learning curve just a bit for you.
I'm always looking for new topics and I'll make sure to add those to the list. Unfortunately I'm mostly experience with web development (mainly backend). Thats why I'm currently doing a series where I build a Twitter clone from scratch. The videos of that are also on this channel in case you're interested.
I have very little experience with embedded stuff and only with Ruby+Rust, not Python. Parsing in general is something I would like to dive more into. Processing large amounts of data sounds like a good fit for Rust.
Let me know if you have any other questions you want me to cover. You're also welcome to join the live streams on twitch.tv/davidpdrsn and ask questions during the stream.
Video starts at 5:05
Bless you
This is wonderfully helpful and I’m only an hour in. Thank you!
I wish you had more time, your coding sessions are great
39:10 Actually stdin can and will run out of input when it is closed and/or reads EOF (end-of-file). This can happen for example when the input is piped into the program or if you press Ctrl-D on the terminal (which will send EOF). If you unwrap on the iterator this will cause a panic. I use Ctrl-D all the time to exit interactive CLI tools.
There is also another use for Ctrl-D in non-raw mode: If you enter some text before pressing Ctrl-D it will not send EOF but instead flush the terminal buffer and pass the entered text to the application similar to entering a newline (but without the newline character at the end).
Oh yeah thats true. I didn't consider stdin being something else than the keyboard. Makes sense! I guess this bit will then go into an infinite loop if there is no more input left github.com/davidpdrsn/delete-git-branches/blob/master/src/main.rs#L107 🤔 Should probably fix that if it is the case.
Thank you for the stream ! Learnt a ton !
Thank you so much for doing this kinda videos, this is super helpful!
3:13:09 I think you could use a label there on the for loop to continue to the label like a goto...like 'outer: for... continue 'outer
Great stream. Definitely learned some good tricks.
At 2:28:24 I think you could have actually used filter_map, but you were returning Result whereas filter_map should output Option, so by returning Option I think it would have compiled.
Also if you delete the last branch in the loop you don't get a chance to undo with your current implementation, do you?
Again thanks for a great stream from a fellow Dane :)
Possibly, but I'm not sure we'd easily be able to use `?` within filter_map 🤔
And yes that is totally true, you cannot undo deleting the last branch. Didn't consider that case. PRs are welcome 😜
🇩🇰✌️
The reason you couldn’t delete master is that it was the branch you currently had checked out. The right thing to do there was to check whether the branch equaled repo.head().
And I just needed to watch for five more minutes.
It's helpful...Like it.
Rust: has 2 types for strings.
Same time C++: const char*, std::string, std::string_view
It actually has way more than two. Cstring, cstr, ostring, ostr, to name a few 😅
Great video - it was very informative.
With using recursion on the act_on_branch, would someone continuously using 'undo' eventually blow the stack ?
In theory yes, but in practice no. First of all the rust compiler (or llvm) might optimise away the recursion and just make a loop instead otherwise you would have to undo more times than you have stack space. I think it would be premature optimisation to worry too much about it.
Thanks for explaining the '?' operator! I was wondering the same thing about using '?' on different error types and you explained it perfectly!
This explanation starts at 31:00 for anyone interested.
Hi, nice video! What would be the best way to list all branches as a list menu so the user can select specific branch with the arrow keys, any library recommendation?
You should be able to build that with crossterm. It supports cursor events and setting colors on lines. You could probably also use the tui crate.
Thanks for the tutorial! I'm also curious about your setup...what are you using to run rust-analyzer? I use coc.nvim but it doesn't look quite the same. Also, are you using tmux? I like your statusbar.
I use github.com/prabirshrestha/vim-lsp. Tried coc but didn't like all the javascript stuff that it required. I'm very happy with vim-lsp. And yes I'm running nvim inside tmux. You can find all my config here github.com/davidpdrsn/dotfiles
Hi @@davidpedersen2649, I'm also enjoying your session very much. I was also much interested in your (n)vim setup as it looks much more responsive from what I use (coc-rust-analyzer). In particular having diagnostics updated while you type look really useful, and light years from the "save to update" behavior of rust-analyzer with CoC. I checked your dot files and it seems now you are using exactly that. AFAIK I was wondering if you just sacrificed responsiveness for other features (better diagnostics?) or if you find a way to make coc-rust-analyzer near the responsiveness of what you had before. Thanks!
No I didn’t do anything special to make it faster. Sounds weird that you’re having issues. Perhaps try opening an issue on either coc or rust-analyzer.
@@davidpedersen2649 strange, from all I read it is a know issue that rust analyzer can't update on the fly and you have to save to "refresh" and get the current errror. There is already one issue and it is marked as a task to make rust-analyzer the default LSP for rust: github.com/rust-analyzer/rust-analyzer/issues/6591, github.com/rust-analyzer/rust-analyzer/issues/4224. From my searches I also seen people mentioning this as a know issue (for example: www.reddit.com/r/neovim/comments/j5fev9/coc_lint_on_rust_files_only_updates_after_saving/). I couldn't find a way to make it update on the fly while I type like it happens to you in the video. Is it really working for you? Thanks!
Not quite sure I follow you. What you’re seeing in the video is what I’m experiencing 😅 I get completions while typing and it checks for errors when I save.
Also what are your text editor settings? It looks like gvim - but you have rust-analyzer errors in line and comment/uncomment blocks at a time?
I neovim with rust-analyzer and github.com/prabirshrestha/vim-lsp. You can find my config here github.com/davidpdrsn/dotfiles. I'm also running tmux to split the screen and stuff. The comment plugin I use is github.com/tpope/vim-commentary
Thanks! I'll take a look at those. I use gvim and Coc but I keep having issues where rust-analyzer fails to complete methods or provide the types.
@@davidpedersen2649 does vim-lsp provide the facility for displaying the errors and warning in-line with code? or are you using a separate plugin for that? I am sorry, if this is commonplace knowledge...
@@davidpedersen2649 Also what terminal emulator do you use btw?
How do you get those warnings/errors inline? I am using nvim and coc but I cant seem to find an option to do that...
I use coc-rust-analyzer. It should show errors inline by default.
@@davidpedersen2649 I use the same however I have to move the cursor to the error indication location to view the warning/error text. Anyways, thank you creating this gem of a stream! In case you decide to do another stream in the future, can you please work on creating a utility which requires some sort of client-server stuff, wherein the server is a daemon on the same machine...
Maybe coc changed since I made this video
@@davidpedersen2649 yeah maybe. Thanks anyways !
"sudo apt install libssl-dev" You're welcome;)
Thx. Does it work on macOS?