Пікірлер
@joshka7634
@joshka7634 2 күн бұрын
P.s. I know you've mentioned ATAC already. You might also be interested in two other Ratatui based apps - openapi-tui and slumber - for some UI ideas in the same space.
@GoRustLang
@GoRustLang 2 күн бұрын
Awesome thank you!
@joshka7634
@joshka7634 3 күн бұрын
51:22 pro-tip, take a look at the docs on the type when the docs on methods don't make sense (i.e. layout::Layout)
@GoRustLang
@GoRustLang 2 күн бұрын
Will do. Still getting used to the rust and crate docs ecosystem. I am so used to the python world I get lost in thinks documenting rust, heh. Total skill issue on my part.
@joshka7634
@joshka7634 2 күн бұрын
@@GoRustLang I think your confusion suggests on the constraints / layout suggests that we could very much do with improving the language used in there to describe what's going on. There's lots of ways that a layout might be interpreted, ratatui's approach is carving up rectangular areas of a screen and then writing widgets into each area. Simple when stated that way, much more complicated when not. Many UI frameworks combine the layout and rendering part (which is generally better IMO, and something that would be useful in a world where we rethink all of the ratatui ways of doing things)
@joshka7634
@joshka7634 3 күн бұрын
8:30 we've added better constructors for Layout in later versions of ratatui (Layout::horizontal and Layout::vertical)
@joshka7634
@joshka7634 3 күн бұрын
3:14 unfortunately ChatGPT data cutoff dates for most models is before ratatui was forked from tui-rs. It's grown something like 50K LoC since the fork (with about 10K of that being docs)
@4wiru
@4wiru 3 күн бұрын
the app evolved quite a bit! congrats on that
@GoRustLang
@GoRustLang 2 күн бұрын
Thanks! It has been an interesting ride.
@joshka7634
@joshka7634 3 күн бұрын
54:34 We've gone through a bunch of iterations of what a good approach for apps and state looks like, and in particular whether to make a ui method that accepts frame or to think in terms of Widgets. The JSON editor was one of the first tutorials that were written after the tui -> ratatui fork, so it hasn't yet been updated / made more idiomatic. Tui-rs was really built around the idea that the widgets were constructed for each frame and then discarded (because the render function in the widget trait consumes self). A few months ago we relaxed that and introduced the WidgetRef trait, made all the built-in widgets non destructive to their state when rendering, which made it possible to store them between frames. This enables things like you see in the tabs example `impl Widget for &App`, which says if you have reference to an App, then you can render this directly instead of building up the widgets to render on each frame. There's another similar approach for tabs in the Demo2 example which is probably worth looking at too. That one pulls each tab into its own type, and lets the type handle rendering the contents (via the widget trait). Strum is a pretty neat crate that adds some missing pieces to make it easy to do things with enums easily (iterate, add display strings, convert from a number to the specific item, etc.), But I can see the mind explode meme happening when you saw it, so it might be too much magic for the example code. It either needs some good comments or perhaps to be replaced with the manual versions of things (which are just a bunch of match statements in a function). If you want to highlight that you're streaming Ratatui content next time, feel free to advertise this on our discord server (which is bridged to matrix too for those that don't discord).
@GoRustLang
@GoRustLang Күн бұрын
Thanks for all of this context it really helps. I am totally going to checkout the strum package and the other demo apps. I need more time in the day :D
@joshka7634
@joshka7634 3 күн бұрын
51:11 It's set by the `#[derive(Default)]` on `App` and on the `SelectedTab` (where the #[default] is mentioned)
@GoRustLang
@GoRustLang 2 күн бұрын
Thanks for the confirmation on this, as you saw I got really lost. :D
@joshka7634
@joshka7634 3 күн бұрын
48:35 Yeah, implementing widget on your app instead of manually calling methods on frame is a pretty nice way of encapsulating your rendering logic into the struct that you care about.
@GoRustLang
@GoRustLang 2 күн бұрын
Awesome, totally going to read up on this. It has a been a lot of fun going down this route and learning about doing TUI's. In the future i'll be able to come up with an idea and put a nice UI in front of it. This has been a lot of fun.
@joshka7634
@joshka7634 3 күн бұрын
46:52 LOL, sounds we need to ditch strum from the examples :D (or at least document that a bit better)
@GoRustLang
@GoRustLang 2 күн бұрын
I still need to figure out what strum does for sure :D It is a hard balance figuring out how much detail to go into vs getting the point across. I know I struggle with that at least.
@joshka7634
@joshka7634 3 күн бұрын
30:35 rustfmt is what you want (run cargo fmt)
@GoRustLang
@GoRustLang 2 күн бұрын
Oh awesome. Thank you! Going to get that going.
@joshka7634
@joshka7634 3 күн бұрын
4:44 there's some good docs on the website about using color-eyre for handling errors nicely (and we're probably going to migrate most of the examples to use that)
@L0wPressure
@L0wPressure 7 күн бұрын
Please go on, it's awesome to see i'm not alone struggling while learning Rust :)
@GoRustLang
@GoRustLang 7 күн бұрын
The struggle is real, but we'll make it 💪
@anitamaxcode
@anitamaxcode 7 күн бұрын
i'm very glad that, i'm not the only one who was lost in the same particular way. i appreciate the work of ratatui a lot but damn the difference from the counter to the json editor is like switching a game from easy to hardcore mode for a rust beginner ^^
@GoRustLang
@GoRustLang 7 күн бұрын
haha for sure. I was shocked at the difference, but once I was able to break it down it made sense.
@joshka7634
@joshka7634 2 күн бұрын
I mentioned in another comment, the JSON editor was one of the earliest tutorials written and hasn't really been updated much since. The counter tutorials are much newer and take into account both the changes in Ratatui and a better understanding of what things people run into when implementing apps. I rewrote it recently (and still have some more parts to add at some point).
@L0wPressure
@L0wPressure 8 күн бұрын
I have a similar approach to learning new things. But i tend to use different ollama models. It used to be codellama, now it's usually llama3.
@paris-panda
@paris-panda 8 күн бұрын
Thanks for the tutorial! I don't know if it's just me who has this preference, but would you consider doing normal tutorial videos (i.e not livestreams)? As interesting as live streams are, sometimes I don't really have the time to go through the whole discovery process and just want to skip ahead to how i actually do the thing. That said, you speak very clearly and explain things well and it looks like you're just getting started with your youtube channel. So hopefully if you try both formats out, you can see which one gets you more viewers... Oh, and also posting a link to source code is always a plus :) Anyway, thanks again for the content and best of luck with the channel! You got +1 Like & Subscribe - Keep up the good work :)
@GoRustLang
@GoRustLang 8 күн бұрын
Ask and you shall receive :D. I just posted my first non-live stream this morning. I do plan to do more of them. They just take a lot of time. That one I released today probably took in the ballpark of 6 to 8 hours from idea, planning, lots of bad example code writing, filming editing etc. Also had to make sure I didn't look stupid 😅. I actually plan to get to a point where I have 3 types of content on the channel 1. livestreams - Tbh I didn't think I would like doing this, but I am enjoying it as it is a fun way to learn and share the experience. Plus explore ideas and areas of rust. 2. Produced content - Short or shorter content that is pre-planned, concise and to the point. 3. Clips - Where I take chunks out of the livestreams that can live standalone on their own so you don't have to deal with the fluff around it I started the channel to push myself to finally learn rust and teach it as a learn it so there is a tight feedback loop for knowing what struggles I have and can help others get through the same ones. So there is going to be a ramp up period where the livestream is going to be the primary video mechanism and as I learn more the Produced content will start to flow. Then eventually when i get good enough clips will start being added as well. That is my current plans. Thanks for the comment and the subcribe I appreciate it.
@gabrielkwong1878
@gabrielkwong1878 10 күн бұрын
Hey! Been following and enjoying the content. If I may suggest some future content maybe you can lookup bevy and maybe make a simple game like pong, space invaders, asteroids, to name a few but using a TUI interface, I think that would be interesting to watch and follow. Anyway, one thing at a time, and keep up the good work. <3
@GoRustLang
@GoRustLang 10 күн бұрын
Ooooh interesting idea. TBH I hadn’t thought about doing any game stuff but that could be fun.
@gabrielkwong1878
@gabrielkwong1878 10 күн бұрын
@@GoRustLang Glad to hear you might be interested, it is quite an endeavor (I haven't had the time myself yet), but I can imagine it being fun to tackle! And an opportunity to contribute to the bevy eco system as an example project or template, which is quite exciting as well. But for now slow and steady haha. Also, while I have your attention and my apologies for mentioning it here abruptly I know you increased the font size in the previous video already but could you increase it a bit more? A good benchmark is to consider viewers on the phone but don't wanna pressure you to increase it to a point that is uncomfortable for you. Anyway super appreciate it and its okay if you don't end up changing anything, its the content that is important.
@SS-wl7od
@SS-wl7od 14 күн бұрын
Keep coding more stuff bro 💪 You have my support
@GoRustLang
@GoRustLang 13 күн бұрын
Will do for sure. I am enjoying it.
@reviraemusic
@reviraemusic 21 күн бұрын
If code could be zoomed in it would help viewers a lot, since this kind of "coding together" video - means split screen - for those without multiple monitors... Thank you very much for the content!
@GoRustLang
@GoRustLang 21 күн бұрын
Thanks! I am going to work on making the font size bigger in the next video.
@melvinhayes2554
@melvinhayes2554 24 күн бұрын
'PromoSM'
@mr.daniish
@mr.daniish 28 күн бұрын
This video was loaded! Fire 🔥
@4wiru
@4wiru Ай бұрын
its funny that I recently started with doing the same idea of a project, a couple of days ago
@4wiru
@4wiru Ай бұрын
using ratatui aswell
@GoRustLang
@GoRustLang Ай бұрын
Great minds 😁. I think a lot of people are frustrated with the state of these tools and want a non bloated version
@4wiru
@4wiru Ай бұрын
@@GoRustLang yeah, i used to use insomnia, but now kong ended that for me, and I've been using curl only
@ShaunPrince
@ShaunPrince Ай бұрын
Such an underrated channel. I love rust, use it everyday and I always learn thing from your videos. Thank-you.
@GoRustLang
@GoRustLang Ай бұрын
Thank you much appreciated. I am glad you like them and learn. It has been a fun journey.
@abdolilahmajid_21
@abdolilahmajid_21 Ай бұрын
best of luck man
@GoRustLang
@GoRustLang Ай бұрын
Thank you
@haonnoah
@haonnoah 2 ай бұрын
So the OS keeps a cache of the ARP requests, but also can listen on the network for other people requesting APR resolution. Additonally network gear like switches and APs can intercept ARP requests and respond directly (if they know)
@GoRustLang
@GoRustLang 2 ай бұрын
Really good point. Thanks for pointing this out.
@haonnoah
@haonnoah 2 ай бұрын
side note it called ARP not A R P. (say 'park' without the k and the p at the end 😂)
@GoRustLang
@GoRustLang 2 ай бұрын
Thanks! I am going to try to get better at this I am sure I will spell it for a while still.
@JoshCarpenterVO
@JoshCarpenterVO 2 ай бұрын
There are alternatives to the match on the unwrap. For example, unwrap_or() which returns an alternate on fail. The unwrap_xx() are a little finicky, but can make things a bit less verbose and easier to read. Raw unwraps are discouraged unless you know that it cannot fail.
@GoRustLang
@GoRustLang 2 ай бұрын
Thanks I appreciate it. It felt weird using unwrap so much, but I figured it was fine for now and at some point on the journey I would know more on it. I will keep this in mind as I am learning and writing more.
@yotubecreators47
@yotubecreators47 3 ай бұрын
I love this kind of calm code only focused videos, keep doing it super helpful
@StephenKingston
@StephenKingston 3 ай бұрын
It's working! 😄
@GoRustLang
@GoRustLang 3 ай бұрын
I can be excitable 😁 thanks for watching.