4 ms·
I'm new to Rust, can someone tell me if that's good Rust code I could learn from? https://github.com/achristmascarl/rainfrog/blob/main/src/app.rs#L89 https://g
by benterix 2y ago
I'm new to Rust, can someone tell me if that's good Rust code I could learn from?
https://github.com/achristmascarl/rainfrog/blob/main/src/app.rs#L89 https://github.com/achristmascarl/rainfrog/blob/main/src/app...
- Icathian 2y agoI only looked at the linked file, so I'm not going to speak to the rest of the code and don't really have a good grasp of the architecture here. This seems mostly ok. The only thing that (imo) wouldn't pass code review is that big honking loop at https://github.com/achristmascarl/rainfrog/blob/main/src/app.rs#L162 https://github.com/achristmascarl/rainfrog/blob/main/src/app.... That thing needs to be refactored down to be readable, with individual logic chunks being put into their own functions and tidied up a bit. That's not really Rust-specific, obviously, but all the `match` and `if let` and whatever other Rust stuff looks fine, so it's what I've got.
- achristmascarl 2y agonope :)
- dmd 2y ago(People downvoting this: that's the author.)
- achristmascarl 2y agoon a more serious note, the library i used for the query editor, tui-textarea [0], is very well done, and the other db tui i drew inspiration from, gobang[1], is a great example of a ratatui app. would recommend checking those out [0] https://github.com/rhysd/tui-textarea https://github.com/rhysd/tui-textarea [1] https://github.com/TaKO8Ki/gobang https://github.com/TaKO8Ki/gobang
- snthpy 2y agoLooks great! I'll be watching your progress with great interest. What do you use for the DataTable widget? Is there a Rust/Ratatui equivalent of DataTable (https://textual.textualize.io/widgets/data_table/ https://textual.textualize.io/widgets/data_table/) used by Harlequin?
- achristmascarl 2y agoyep! ratatui has the Table widget: https://docs.rs/ratatui/latest/ratatui/widgets/struct.Table.html https://docs.rs/ratatui/latest/ratatui/widgets/struct.Table....