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

Crossterm 0.25.0 breaking changes #35

Closed
fangpinsern opened this issue Oct 21, 2022 · 4 comments
Closed

Crossterm 0.25.0 breaking changes #35

fangpinsern opened this issue Oct 21, 2022 · 4 comments

Comments

@fangpinsern
Copy link

When using crossterm 0.25.0 with termimad 0.20.3, I get the following error when I followed the code example in the docs:

error[E0308]: mismatched types
 --> src/theme.rs:9:46
  |
9 |     skin.strikeout = CompoundStyle::new(Some(Red), None, Bold.into());
  |                                              ^^^ expected enum `crossterm::style::types::color::Color`, found enum `Color`
  |
  = note: perhaps two different versions of crate `crossterm` are being used?

error[E0277]: the trait bound `crossterm::style::attributes::Attributes: From<Attribute>` is not satisfied
 --> src/theme.rs:9:63
  |
9 |     skin.strikeout = CompoundStyle::new(Some(Red), None, Bold.into());
  |                                                               ^^^^ the trait `From<Attribute>` is not implemented for `crossterm::style::attributes::Attributes`
  |
  = help: the following implementations were found:
            <crossterm::style::attributes::Attributes as From<&[crossterm::style::types::attribute::Attribute]>>
            <crossterm::style::attributes::Attributes as From<crossterm::style::types::attribute::Attribute>>
  = note: required because of the requirements on the impl of `Into<crossterm::style::attributes::Attributes>` for `Attribute`

From this answer, it seems there there is a breaking change between crossterm 0.23 and crossterm 0.25.
https://stackoverflow.com/questions/74141606/cannot-compile-rust-program-due-to-e0308-error/74144038#74144038

Is it possible to state what version of crossterm supported by termimad or update the library to accept the newest version of crossterm?

@Canop
Copy link
Owner

Canop commented Oct 21, 2022

Libraries whose version are in 0.x have an unstable API. This is the case for Crossterm, which had breaking changes in 0.24 and 0.25.
When Crossterm changes, it's sometimes easy to update the libraries using them. It sometimes isn't. Right now, Crossterm 0.25 has major breaking changes and may not bring immediate benefits. So I'm currently postponing an update which will force crossterm based libraries to change their API too.
Right now, I'll add a compatibility note in the README and we'll keep this issue open until Termimad is changed to be compatible with 0.25 (or more recent).

Canop added a commit that referenced this issue Oct 21, 2022
@fangpinsern
Copy link
Author

Sounds good thanks!!

@EverlastingBugstopper
Copy link
Contributor

Since crossterm is needed for styling - would you ever consider re-exporting the styles directly? You could potentially gate this behind a feature flag (which I would argue should be enabled by default). This error message (mismatched versions) is the most frequent error I encounter with this crate, and this crate is the only thing I need to use crossterm directly for. It would be great if I only had to specify one dependency instead of two in order to use this crate!

@Canop
Copy link
Owner

Canop commented Jan 18, 2024

The new release of Termimad, version 0.28, reexports crossterm 0.27.

To be sure of the compatibility, don't import crossterm directly but use termimad::crossterm.

@Canop Canop closed this as completed Jan 18, 2024
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

3 participants