Closed joshka closed 7 months ago
Hey there!
Sure, my comment wasn't any sly against Ratatui, I love using it and am glad you guys move fast to make the API as clean as possible.
I haven't dug super deep, but looking at it now with fresh eyes it'stui-textarea pulling in 0.24.0, and Oatmeal trying to pull in 0.25.0, and they're not playing nice together. I'd actually probably blame cargo+myself with how I'm pinning dependencies.
Compiling oatmeal v0.12.3 (/Users/user/git/oatmeal)
error[E0277]: the trait bound `impl ratatui::widgets::Widget + '_: Widget` is not satisfied
--> src/application/ui.rs:117:37
|
117 | frame.render_widget(textarea.widget(), layout[1]);
| ------------- ^^^^^^^^^^^^^^^^^ the trait `Widget` is not implemented for `impl ratatui::widgets::Widget + '_`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `Widget`:
BarChart<'a>
ratatui::widgets::Block<'a>
Canvas<'a, F>
Chart<'a>
ratatui::widgets::Clear
Gauge<'a>
LineGauge<'a>
List<'a>
and 4 others
note: required by a bound in `Frame::<'_>::render_widget`
--> /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/ratatui-0.25.0/src/terminal.rs:614:12
|
612 | pub fn render_widget<W>(&mut self, widget: W, area: Rect)
| ------------- required by a bound in this associated function
613 | where
614 | W: Widget,
| ^^^^^^ required by this bound in `Frame::<'_>::render_widget`
error[E0308]: mismatched types
--> src/domain/models/textarea.rs:12:13
|
11 | textarea.set_block(
| --------- arguments to this method are incorrect
12 | / Block::default()
13 | | .borders(Borders::ALL)
14 | | .border_type(BorderType::Double)
15 | | .title("Enter prompt")
16 | | .padding(Padding::new(1, 1, 0, 0)),
| |__________________________________________________^ expected `ratatui::widgets::block::Block<'_>`, found `ratatui::widgets::Block<'_>`
|
= note: `ratatui::widgets::Block<'_>` and `ratatui::widgets::block::Block<'_>` have similar names, but are actually distinct types
note: `ratatui::widgets::Block<'_>` is defined in crate `ratatui`
--> /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/ratatui-0.25.0/src/widgets/block.rs:233:1
|
233 | pub struct Block<'a> {
| ^^^^^^^^^^^^^^^^^^^^
note: `ratatui::widgets::block::Block<'_>` is defined in crate `ratatui`
--> /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/ratatui-0.24.0/src/widgets/block.rs:230:1
|
230 | pub struct Block<'a> {
| ^^^^^^^^^^^^^^^^^^^^
= note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
--> /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-textarea-0.4.0/src/textarea.rs:1648:12
|
1648 | pub fn set_block(&mut self, block: Block<'a>) {
| ^^^^^^^^^
Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `oatmeal` (bin "oatmeal") due to 2 previous errors
Thanks for the extra info :) I definitely didn't take it as a slight - I was more interested to check if we'd broken something without knowing. I've seen the similar textarea related problems pop up from time to time. I think they're usually fixed by running cargo update.
For an app I'd really suggest just letting your lock file do the dependency pinning and make sure your install instructions specify --locked
. This says to the user "use the versions I've tested this with, it might work with updated versions, but you're on your own if it breaks". Particularly for something that hits a network API, I'd want that to generally stay updated. Also this gives you power to be explicit when pinning to address a breaking change rather than never really knowing whether your updates will break things.
Originally posted by @dustinblackman in https://github.com/dustinblackman/oatmeal/issues/33#issuecomment-1872940856
I wonder if you can expand a bit on what broke in 0.25 for oatmeal?
I just bumped the version of Ratatui in Cargo.toml and it compiles and tests fine. I also bumped every package to latest without failure (except
yansi
, which has a small api change in the 1.0.0 gamma release)