crossterm-rs / crossterm

Cross platform terminal library rust
MIT License
3.29k stars 280 forks source link

Add functions to allow constructing `Attributes` in a const context #817

Closed kierdavis closed 10 months ago

kierdavis commented 1 year ago

Previously, the only ways to construct new Attributes values were Attributes::default() or Attributes::from(_), neither of can be made const fn due to limitations of these standard library traits.

kierdavis commented 1 year ago

I tried to test with the MSRV in Cargo.toml, 1.58.0, but got:

[nix-shell:~/checkouts/crossterm]$ rm -rf Cargo.lock target
[nix-shell:~/checkouts/crossterm]$ cargo version
cargo 1.58.0 (7f08ace4f 2021-11-24)
[nix-shell:~/checkouts/crossterm]$ cargo test
error: failed to parse manifest at `/home/kier/checkouts/crossterm/Cargo.toml`

Caused by:
  namespaced features with the `dep:` prefix are only allowed on the nightly channel and requires the `-Z namespaced-features` flag on the command-line

which I don't think is related to my changes. All tests pass on Rust 1.60.0 (oldest) and 1.72.0 (newest).