lusingander / stu

TUI explorer application for Amazon S3 (AWS S3) 🪣
https://lusingander.github.io/stu/
MIT License
245 stars 8 forks source link

Cannot build on Asahi Linux Arm64 #11

Closed tmeijn closed 4 months ago

tmeijn commented 4 months ago

Hey, came across this project from https://terminaltrove.com

However I am not able to build the project when running cargo install stu. It gives me the following error:

   Compiling stu v0.5.0
error[E0277]: a value of type `Vec<ratatui::text::Line<'_>>` cannot be built from an iterator over elements of type `ratatui::text::line::Line<'_>`
  --> /home/tmeijn/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/stu-0.5.0/src/widget/text_preview.rs:81:51
   |
81 |             Ok(s.into_text().unwrap().into_iter().collect())
   |                                                   ^^^^^^^ value of type `Vec<ratatui::text::Line<'_>>` cannot be built from `std::iter::Iterator<Item=ratatui::text::line::Line<'_>>`
   |
   = help: the trait `FromIterator<ratatui::text::line::Line<'_>>` is not implemented for `Vec<ratatui::text::Line<'_>>`
   = help: the trait `FromIterator<ratatui::text::Line<'_>>` is implemented for `Vec<ratatui::text::Line<'_>>`
   = help: for that trait implementation, expected `ratatui::text::Line<'_>`, found `ratatui::text::line::Line<'_>`
note: the method call chain might not have had the expected associated types
  --> /home/tmeijn/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/stu-0.5.0/src/widget/text_preview.rs:74:18
   |
73 |               let s = LinesWithEndings::from(s)
   |                       ------------------------- this expression has type `LinesWithEndings<'_>`
74 |                   .map(|line| {
   |  __________________^
75 | |                     let ranges: Vec<(syntect::highlighting::Style, &str)> =
76 | |                         h.highlight_line(line, &SYNTAX_SET).unwrap();
77 | |                     as_24_bit_terminal_escaped(&ranges[..], false)
78 | |                 })
   | |__________________^ `Iterator::Item` is `String` here
...
81 |               Ok(s.into_text().unwrap().into_iter().collect())
   |                                         ----------- `Iterator::Item` is `Line<'_>` here
note: required by a bound in `collect`
  --> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/iter/traits/iterator.rs:1999:5
help: consider removing this method call, as the receiver has type `ratatui::text::text::Text<'_>` and `ratatui::text::text::Text<'_>: FromIterator<ratatui::text::line::Line<'_>>` trivially holds
   |
81 -             Ok(s.into_text().unwrap().into_iter().collect())
81 +             Ok(s.into_text().unwrap().collect())
   |

For more information about this error, try `rustc --explain E0277`.
error: could not compile `stu` (bin "stu") due to 1 previous error
error: failed to compile `stu v0.5.0`, intermediate artifacts can be found at `/tmp/cargo-installJJEe4L`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
lusingander commented 4 months ago

Thank you for your report.

For now, could you please check if it can be installed by running cargo install --locked stu? It seems to be a library version issue...

tmeijn commented 4 months ago

That indeed worked @lusingander!

lusingander commented 4 months ago

Thank you for confirming 🙂 I've updated the README: https://github.com/lusingander/stu/commit/faca2a1550d3cb71d6a62ecd2b8a1e1531271352

lusingander commented 4 months ago

I think updating the documentation will solve the issue.