tatounee / ratatui-explorer

A simple library for creating file explorer for the ratatui crate.
MIT License
22 stars 4 forks source link

f.render_widget(&file_explorer.widget(), f.size()); // this line can't be compiled #3

Closed pcenshao closed 4 weeks ago

pcenshao commented 1 month ago

` use color_eyre::Result; use crossterm::event::{self, Event, KeyCode, KeyEvent, KeyEventKind, KeyModifiers}; use ratatui::{ style::Stylize, text::Line, widgets::{Block, Paragraph}, DefaultTerminal, Frame, };

use ratatui_explorer::{FileExplorer, Theme};

....

// Render the file explorer widget. terminal.draw(|f| { f.render_widget(&file_explorer.widget(), f.size()); // this line can't be compiled })?;

.... ` the information is :

error[E0277]: the trait bound&impl ratatui::widgets::WidgetRef + '_: Widget` is not satisfied --> src/app.rs:61:30 61 frame.render_widget(&widget,frame.area()); ------------- ^^^^^^ the trait WidgetRef is not implemented for impl ratatui::widgets::WidgetRef + '_, which is required by &impl ratatui::widgets::WidgetRef + '_: Widget
required by a bound introduced by this call

`

and my environment is: rustc version: rustc 1.81.0 (eeb90cda1 2024-09-04) (Homebrew) cargo version: 1.81.0

[dependencies] crossterm = "0.28.1" ratatui = { version = "0.28.1",features = ["unstable-widget-ref"] } color-eyre = "0.6.3" ratatui-explorer = "0.1.1"

then I use your examples,the result also is like above . thanks.

hcavarsan commented 1 month ago

@pcenshao, this PR (https://github.com/tatounee/ratatui-explorer/pull/2) fixes the issue. I’m waiting for a code review.

tatounee commented 4 weeks ago

Indeed, it has been merged and fix !