From 78e13c77d7de86cf6d95dfaaf3ff71fec95d0cb4 Mon Sep 17 00:00:00 2001 From: chenx97 Date: Tue, 22 Aug 2023 15:02:52 +0800 Subject: [PATCH 1/2] Update to rustix 0.38 --- Cargo.toml | 2 +- src/unix.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cc60dac..fc8f7e2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ edition = "2018" [target.'cfg(not(windows))'.dependencies] -rustix = { version = "0.37.0", features = ["termios"] } +rustix = { version = "0.38.0", features = ["termios"] } [target.'cfg(windows)'.dependencies.windows-sys] version = "0.48.0" diff --git a/src/unix.rs b/src/unix.rs index b218b1e..5fc7256 100644 --- a/src/unix.rs +++ b/src/unix.rs @@ -1,5 +1,5 @@ use super::{Height, Width}; -use rustix::fd::BorrowedFd; +use rustix::fd::{BorrowedFd, AsRawFd}; use std::os::unix::io::RawFd; /// Returns the size of the terminal. @@ -8,11 +8,11 @@ use std::os::unix::io::RawFd; /// The size of the first stream that is a TTY will be returned. If nothing /// is a TTY, then `None` is returned. pub fn terminal_size() -> Option<(Width, Height)> { - if let Some(size) = terminal_size_using_fd(rustix::io::raw_stdout()) { + if let Some(size) = terminal_size_using_fd(std::io::stdout().as_raw_fd()) { Some(size) - } else if let Some(size) = terminal_size_using_fd(rustix::io::raw_stderr()) { + } else if let Some(size) = terminal_size_using_fd(std::io::stderr().as_raw_fd()) { Some(size) - } else if let Some(size) = terminal_size_using_fd(rustix::io::raw_stdin()) { + } else if let Some(size) = terminal_size_using_fd(std::io::stdin().as_raw_fd()) { Some(size) } else { None From c24c1c34e51408c70136c9e6cff79d6d60f8aeed Mon Sep 17 00:00:00 2001 From: chenx97 Date: Wed, 30 Aug 2023 11:17:56 +0800 Subject: [PATCH 2/2] Bump MSRV to 1.63.0 --- .github/workflows/main.yml | 4 ++-- Cargo.toml | 2 +- README.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index df8452e..8fd7b74 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - toolchain: [1.48.0, stable, beta, nightly] + toolchain: [1.63.0, stable, beta, nightly] steps: - name: Checkout repository uses: actions/checkout@v3 @@ -38,7 +38,7 @@ jobs: strategy: fail-fast: false matrix: - toolchain: [1.48.0, stable, beta, nightly] + toolchain: [1.63.0, stable, beta, nightly] steps: - name: Checkout repository uses: actions/checkout@v3 diff --git a/Cargo.toml b/Cargo.toml index fc8f7e2..ff7af2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ documentation = "https://docs.rs/crate/terminal_size" repository = "https://github.com/eminence/terminal-size" keywords = ["terminal", "console", "term", "size", "dimensions"] license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" [target.'cfg(not(windows))'.dependencies] diff --git a/README.md b/README.md index 7257233..30e8872 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ if let Some((Width(w), Height(h))) = size { ## Minimum Rust Version -This crate requires a minimum rust version of 1.48.0 (2020-11-19) +This crate requires a minimum rust version of 1.63.0 (2022-08-11) ## License