Counter App Multiple Functions code is not compiling for me #151
-
Greetings - I am working my way through the book and I ran into an error with the code at the bottom of this page. https://ratatui.rs/tutorial/counter-app/multiple-functions.html I can open an issue and a PR for this, but I wanted to check first if it's just me. This is the error I'm getting: error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
--> src/main.rs:12:31
|
12 | pub type Frame<'a> = ratatui::Frame<'a, CrosstermBackend<std::io::Stderr>>;
| ^^^^^ --------------------------------- help: remove this generic argument
| |
| expected 0 generic arguments
|
note: struct defined here, with 0 generic parameters
--> /Users/markboyd/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.24.0/src/terminal.rs:557:12
|
557 | pub struct Frame<'a> {
| ^^^^^
For more information about this error, try `rustc --explain E0107`.
error: could not compile `ratatui-counter-app` (bin "ratatui-counter-app") due to previous error When I change this line: pub type Frame<'a> = ratatui::Frame<'a, CrosstermBackend<std::io::Stderr>>; to this: pub type Frame<'a> = ratatui::Frame<'a>; then it compiles and the app works as expected. I'm a complete newbie to Rust, and some of this here is over my head, but if someone else can confirm this, could I make a PR for this issue? If it is user error, I would love to know also. As a sanity check, here's my [package]
name = "ratatui-counter-app"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1.0.75"
crossterm = "0.27.0"
ratatui = "0.24.0" Just in case this is relevant: Mac Mini PS: I just got to the Question section at the bottom of the page, and the number I put in It even has a little pause before it repeats, just like it normally does in a text editor app. I figure this might just be a peculiarity of how it run on my machine and doesn't have anything to do with Ratatui, so I figured it was worth mentioning but not enough to start its own topic. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Code in the tutorial is using ratatui v0.23 but this breaking change happened in v0.24: https://ratatui.rs/highlights/v0.24.html#frame-no-more-generics- A PR would be welcome! |
Beta Was this translation helpful? Give feedback.
-
Does it not affect your CPU utilization? With a low number you should see a higher CPU utilization. |
Beta Was this translation helpful? Give feedback.
Code in the tutorial is using ratatui v0.23 but this breaking change happened in v0.24: https://ratatui.rs/highlights/v0.24.html#frame-no-more-generics-
A PR would be welcome!