Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with_name issue #25

Open
im-n1 opened this issue Sep 16, 2020 · 1 comment
Open

with_name issue #25

im-n1 opened this issue Sep 16, 2020 · 1 comment

Comments

@im-n1
Copy link

im-n1 commented Sep 16, 2020

Cursive library introduced new trait: https://docs.rs/cursive/0.15.0/cursive/traits/trait.Nameable.html#method.with_name

This breaks this library if I want to use with_name() or NamedView directly.

My example usage gives me this error when I try to wrap table with NamedView:

error[E0277]: the trait bound `cursive_table_view::TableView<ui::images::ImageTableRow, ui::images::ImageTableColumn>: cursive_core::view::view_wrapper::ViewWrapper` is not satisfied
  --> src/ui/images.rs:81:29
   |
81 |       ui.add_fullscreen_layer(NamedView::new(
   |  _____________________________^
82 | |         "images_table",
83 | |         ResizedView::with_full_screen(table),
84 | |     ));
   | |_____^ the trait `cursive_core::view::view_wrapper::ViewWrapper` is not implemented for `cursive_table_view::TableView<ui::images::ImageTableRow, ui::images::ImageTableColumn>`
   |
   = note: required because of the requirements on the impl of `cursive_core::view::view_trait::View` for `cursive_table_view::TableView<ui::images::ImageTableRow, ui::images::ImageTableColumn>`
   = note: required because of the requirements on the impl of `cursive_core::view::view_wrapper::ViewWrapper` for `cursive_core::views::resized_view::ResizedView<cursive_table_view::TableView<ui::images::ImageTableRow, ui::images::ImageTableColumn>>`
   = note: required because of the requirements on the impl of `cursive_core::view::view_trait::View` for `cursive_core::views::resized_view::ResizedView<cursive_table_view::TableView<ui::images::ImageTableRow, ui::images::ImageTableColumn>>`
   = note: required because of the requirements on the impl of `cursive_core::view::view_wrapper::ViewWrapper` for `cursive_core::views::named_view::NamedView<cursive_core::views::resized_view::ResizedView<cursive_table_view::TableView<ui::images::ImageTableRow, ui::images::ImageTableColumn>>>`
   = note: required because of the requirements on the impl of `cursive_core::view::view_trait::View` for `cursive_core::views::named_view::NamedView<cursive_core::views::resized_view::ResizedView<cursive_table_view::TableView<ui::images::ImageTableRow, ui::images::ImageTableColumn>>>`
   = note: required because of the requirements on the impl of `cursive_core::view::into_boxed_view::IntoBoxedView` for `cursive_core::views::named_view::NamedView<cursive_core::views::resized_view::ResizedView<cursive_table_view::TableView<ui::images::ImageTableRow, ui::images::ImageTableColumn>>>`

I'm no expert but Cursive provides convinient macro that can help with this implementation: https://github.com/gyscos/cursive/blob/main/cursive-core/src/view/view_wrapper.rs#L13

@gyscos
Copy link
Collaborator

gyscos commented Jan 19, 2021

This is most likely a version mismatch between the version of cursive you use, and the one used in this library. The hint "ViewWrapperis not implemented" is a bit misleading;Viewis what is actually required, rustc sees thatViewWrapperimplementsView`, and that's what is offers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants