One trick for maximizing type inference with collect() is using '_', e.g.: '.collect::()'. Rust can almost always infer what the element type is. Less typing now, less changes later if you decide to change the element type.
very true, thanks for mentioning that. I usually treat collect() as an error shortcut point, so instead of inferring I tend to type it so that the type I want is concrete at that location and the errors report with that type rather than having longer inference chains. I think this especially helps with a crate like palette, which has a larger than average amount of type aliases that are all effectively Rgb.
@@chrisbiscardi If you're specifying the complete type on purpose (instead of just because rust can't infer it), it may make more sense to put it on the variable declaration instead of as a turbofish on the collect() call.
Thank you for the video. The topic is interesting, and it would be easier to follow if you could do a from-scratch video where you explain the process step by step.
I was thinking about making a litte 'TODO:'-comment scanning cli, that searches a code base and outputs the comments with the file path to click on to start learning go, but I'm kinda tempted to do that with rust now.
The person that made ripgrep also maintains some useful directory-walking crates and such, like walkdir: docs.rs/walkdir/latest/walkdir/ that would help if you went the Rust route. You could even depend on the grep crate from ripgrep's internals (although the internal ripgrep crates are not documented, so it depend on how comfortable you are with Rust and what you want your TODO CLI to do) -- github.com/BurntSushi/ripgrep/blob/master/crates/grep/examples/simplegrep.rs
@@chrisbiscardi I have hardly any experience with rust, just some messing around and playing a little, this would be my first project in it. Thanks for the resources. 😁
I noticed at 1:24 that your help output is coloured. That's supposed to be gone in 4.0, so how is that possible? I built the repo and mine comes out monochrome as expected. Is it just your terminal somehow colouring it by itself?
Not sure how you manage to deliver that much good videos almost daily but thanks a lot, I upgraded my CLI yesterday to v4
One trick for maximizing type inference with collect() is using '_', e.g.: '.collect::()'. Rust can almost always infer what the element type is. Less typing now, less changes later if you decide to change the element type.
very true, thanks for mentioning that.
I usually treat collect() as an error shortcut point, so instead of inferring I tend to type it so that the type I want is concrete at that location and the errors report with that type rather than having longer inference chains.
I think this especially helps with a crate like palette, which has a larger than average amount of type aliases that are all effectively Rgb.
@@chrisbiscardi If you're specifying the complete type on purpose (instead of just because rust can't infer it), it may make more sense to put it on the variable declaration instead of as a turbofish on the collect() call.
Thank you for the video. The topic is interesting, and it would be easier to follow if you could do a from-scratch video where you explain the process step by step.
I was thinking about making a litte 'TODO:'-comment scanning cli, that searches a code base and outputs the comments with the file path to click on to start learning go, but I'm kinda tempted to do that with rust now.
btw first time I see one of your videos, very good so far. keep it up mate💪
The person that made ripgrep also maintains some useful directory-walking crates and such, like walkdir: docs.rs/walkdir/latest/walkdir/ that would help if you went the Rust route.
You could even depend on the grep crate from ripgrep's internals (although the internal ripgrep crates are not documented, so it depend on how comfortable you are with Rust and what you want your TODO CLI to do) -- github.com/BurntSushi/ripgrep/blob/master/crates/grep/examples/simplegrep.rs
@@chrisbiscardi I have hardly any experience with rust, just some messing around and playing a little, this would be my first project in it. Thanks for the resources. 😁
I noticed at 1:24 that your help output is coloured. That's supposed to be gone in 4.0, so how is that possible? I built the repo and mine comes out monochrome as expected. Is it just your terminal somehow colouring it by itself?
yeah, nushell allows me to set colors for a number of things, and I do have some of them set -- www.nushell.sh/book/coloring_and_theming.html
Love your Rust videos. Keep it up 🔥
Julius Pringles thanksgiving ca early
thanks mate tNice tutorials was a big help
sometimes i dream of this zip().map() in typescript :-P
GG