Update rust toolchain to 1.84 (#3945)

* chore: Remove deprecated `Makefile.toml`

which really should have been deleted as part of #2012. This hasn't been
updated for more than 2 years now and I don't expect anyone to still use
this. Our build process is now managed by `cargo xtask`.

* Cargo: Update the Rust toolchain to 1.84.0

from 1.75.0 which has been deprecated for a while now. Along with this
change, the `wasm32-wasi` target is no longer available (see subsequent
commit for additional info).

* chore: Rename `wasm32-wasi` to `wasm32-wasip1`

as required by the Rust project. The `wasm32-wasi` target name has been
retired and will likely be reused at a later time, although to express
an entirely different target (i.e. implementation of the WASI standard).

For additional information, see:

  - https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html
  - https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html#wasi-01-target-naming-changed

* chore: Drop `rust-analysis` component

from the `rust-toolchain.toml` definition. This was added way back in
2021 via 8688569a, and while I'm not sure what it expressed back then,
nowadays it refers to [Metadata for RLS][1], which apparently was an
early language server implementation and has long since been replaced by
*rust-analyzer*.

We don't want to propose or enforce the use of a specific toolchain and
in any case, setting this up properly is the job of a developers
IDE/Editor.

[1]:
1f06e3b31d/doc/user-guide/src/concepts/components.md (previous-components)

* chore: Adhere to type rename

from `std::panic::PanicInfo` to `std::panic::PanicHookInfo`, which was
introduced in Rust 1.81.0. For additional information, see:

- https://releases.rs/docs/1.81.0/#compatibility-notes
- https://github.com/rust-lang/rust/pull/115974/

* fix(utils/data): Adhere to expected case

in match arm patterns, since the expression being matched against has
been modified using `to_ascii_lowercase`. Hence, we cannot have upper
case ASCII chars in the expressions (these arms were previously no-ops).

* fix(utils): Derive `Hash` manually

in `input/layout` since the `PartialEq` trait is also implemented
manually. Previously the `Hash` impl wasn't consistent with the `Eq`
impl, which can have weird effects when using these types in e.g.
`HashMap`s or similar types. For additional information, see:

  - https://rust-lang.github.io/rust-clippy/master/index.html#derived_hash_with_manual_eq
  - https://doc.rust-lang.org/stable/std/hash/trait.Hash.html#hash-and-eq

* fix(utils): Derive `Hash` manually

in `pane_size` since the `PartialEq` trait is also implemented manually.
Previously the `Hash` impl wasn't consistent with the `Eq` impl, which
can have weird effects when using these types in e.g. `HashMap`s or
similar types. For additional information, see:

  - https://rust-lang.github.io/rust-clippy/master/index.html#derived_hash_with_manual_eq
  - https://doc.rust-lang.org/stable/std/hash/trait.Hash.html#hash-and-eq

* fix(server): Don't redeclare variables

with their same names. Latest rust toolchains reject this code.

* chore(actions): Use non-archived toolchain setup

for the Rust toolchain. The previously used action has been archived
over a year ago. The new one should also support reading our
`rust-toolchain.toml`, so we no longer have to keep track of the
toolchain in multiple places.

* chore(actions): Add some space to YAML files

to make them better visually parsable.

* ci: Remove toolchain update Job

since as far as I can tell, this isn't used any more.

* ci: Fix invalid actions specification

and only request an action without running other code.

* CHANGELOG: Add PR #3945.
This commit is contained in:
har7an 2025-01-25 17:43:49 +00:00 committed by GitHub
parent fe792643f7
commit 10df29ed11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 88 additions and 372 deletions

View file

@ -30,26 +30,29 @@ jobs:
options: -v ${{ github.workspace }}/target:/usr/src/zellij --name ssh
steps:
- uses: actions/checkout@v3
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Add WASM target
run: rustup target add wasm32-wasi
- name: Install musl-tools
run: sudo apt-get install -y --no-install-recommends musl-tools
- name: Add musl target
run: rustup target add x86_64-unknown-linux-musl
#run: cargo install --debug cargo-make
- uses: Swatinem/rust-cache@v2
# ensure the target folder exists, otherwise fixtures won't be in the right place
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
- name: Create target folder
run: mkdir -p ${{ github.workspace }}/target
# we copy this manually into the target folder instead of mounting it because
# github actions creates the service first, and if it has a mount that is part
# of your yet unchecked out code, you cannot checkout the code after the mount
- name: Copy fixtures folder to target
run: cp -r ${{ github.workspace }}/src/tests/fixtures ${{ github.workspace }}/target
- name: Restart ssh container
# we need to do this because otherwise the volume will not be mounted
# on the docker container, since it was created before the folder existed

View file

@ -53,28 +53,18 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Add WASM target
run: rustup target add wasm32-wasi
- name: Install musl-tools
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y --no-install-recommends musl-tools
# Workaround for <https://github.com/actions/virtual-environments/issues/2557>
- name: Switch Xcode SDK
if: runner.os == 'macos'
run: |
cat <<EOF >> "$GITHUB_ENV"
SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
EOF
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.rust }}
target: "${{ matrix.target }},wasm32-wasip1"
# Just to make sure the cache doesn't interfere with the build here
cache: false
rustflags: ""
- name: Build release binary
run: cargo xtask ci cross ${{ matrix.target }}

View file

@ -22,14 +22,17 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup toolchain
run: rustup show
- uses: Swatinem/rust-cache@v2
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
- name: Build
run: cargo xtask build
@ -45,13 +48,17 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup toolchain
run: rustup show
- uses: Swatinem/rust-cache@v2
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
- name: Test
run: cargo xtask test
@ -61,7 +68,11 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup toolchain
run: rustup show
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
- name: Check Format
run: cargo xtask format --check

View file

@ -1,25 +0,0 @@
name: update-rust-toolchain
on:
workflow_dispatch: # allows manual triggering
schedule:
- cron: '0 0 1 * *' # runs on the first of every month at 00:00
jobs:
update-rust-toolchain:
name: "Update rust-toolchain"
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: update rust toolchain
id: urt
uses: a-kenji/update-rust-toolchain@v1.1
with:
minor-version-delta: 2
toolchain-path: './rust-toolchain.toml'
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
pr-labels: |
dependencies
automated
rust

View file

@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
* feat(terminal): mouse AnyEvent tracking (https://github.com/zellij-org/zellij/pull/3538)
* fix(terminal): support setting kitty keyboard protocol with `CSI=` (https://github.com/zellij-org/zellij/pull/3942)
* fix(floating-panes): handle various errors (https://github.com/zellij-org/zellij/pull/3944)
* chore(rust): Update Rust toolchain to 1.84.0 (https://github.com/zellij-org/zellij/pull/3945)
## [0.41.2] - 2024-11-19
* fix(input): keypresses not being identified properly with kitty keyboard protocol in some terminals (https://github.com/zellij-org/zellij/pull/3725)

View file

@ -9,7 +9,7 @@ repository = "https://github.com/zellij-org/zellij"
homepage = "https://zellij.dev"
include = ["src/**/*", "assets/layouts/*", "assets/config/*", "LICENSE.md", "README.md", "!**/*_test.*", "!**/tests/**/*"]
# NOTE: When updating this, modify `channel` in `rust-toolchain.toml` accordingly
rust-version = "1.75"
rust-version = "1.84"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -1,284 +0,0 @@
# Global Settings
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_TARGET_DIR = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target"
SKIP_TEST = false
ZELLIJ_EXAMPLE_DIR = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/example"
ZELLIJ_ASSETS_DIR = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/zellij-utils/assets"
# Add clippy to the default flow
[tasks.dev-test-flow]
dependencies = [
"plugins",
"format-flow",
"format-toml-conditioned-flow",
"pre-build",
"build",
"post-build",
"test-flow",
"clippy",
]
[tasks.test]
dependencies = ["get-host-triple"]
args = ["test", "--target", "${CARGO_HOST_TRIPLE}", "--", "@@split(CARGO_MAKE_TASK_ARGS,;)"]
# Running Zellij using the development data directory
[tasks.run]
workspace = false
dependencies = ["build-workspace"]
run_task = "launch"
[tasks.build-workspace]
run_task = { name = "build", fork = true }
[tasks.build]
env = { "CARGO_MAKE_WORKSPACE_SKIP_MEMBERS" = "default-plugins*" }
args = ["build"]
[tasks.build-release]
args = ["build", "--release"]
[tasks.build-e2e-data-dir]
dependencies = ["plugins-release"]
script_runner = "@duckscript"
script = '''
target_dir = set ${CARGO_TARGET_DIR}
data_dir = set ${target_dir}/e2e-data
rm -r ${data_dir}
plugins = glob_array ${target_dir}/wasm32-wasi/release/*.wasm
mkdir ${data_dir}
mkdir ${data_dir}/plugins
for plugin in ${plugins}
plugin_name = basename ${plugin}
cp ${plugin} ${data_dir}/plugins/${plugin_name}
end
writefile ${data_dir}/VERSION ${CARGO_MAKE_CRATE_VERSION}
'''
[tasks.launch]
command = "cargo"
args = [
"run",
"--",
"--data-dir",
"${CARGO_TARGET_DIR}/dev-data/",
"@@split(CARGO_MAKE_TASK_ARGS,;)",
]
# Simple clippy tweak
[tasks.clippy]
dependencies = ["plugins"]
args = ["clippy", "--all-targets", "--all-features", "@@split(CARGO_MAKE_TASK_ARGS,;)"]
# Release building and installing Zellij
[tasks.install]
workspace = false
dependencies = ["wasm-opt-plugins", "build-release", "manpage"]
script_runner = "@duckscript"
script = '''
if is_dir ${CARGO_MAKE_TASK_ARGS}
trigger_error "You need to specify a full path for the binary, not just a directory!"
else
cp ${CARGO_TARGET_DIR}/release/${CARGO_MAKE_CRATE_NAME} ${CARGO_MAKE_TASK_ARGS}
end
'''
[tasks.wasm-opt-plugins]
alias = "plugins-release"
[tasks.plugins-release]
workspace = false
script_runner = "@duckscript"
script = '''
plugins = glob_array ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/default-plugins/*
out_dir = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/zellij-utils/assets/plugins/
mkdir ${out_dir}
for plugin in ${plugins}
cd ${plugin}
exec cargo build --release
plugin_name = basename ${plugin}
plugin_in = set ${CARGO_TARGET_DIR}/wasm32-wasi/release/${plugin_name}.wasm
plugin_out = set ${out_dir}/${plugin_name}.wasm
exec wasm-opt -O ${plugin_in} -o ${plugin_out}
cd ..
end
'''
[tasks.plugins]
workspace = false
script_runner = "@duckscript"
script = '''
plugins = glob_array ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/default-plugins/*
out_dir = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/zellij-utils/assets/plugins/
mkdir ${out_dir}
for plugin in ${plugins}
cd ${plugin}
exec cargo build
plugin_name = basename ${plugin}
plugin_in = set ${CARGO_TARGET_DIR}/wasm32-wasi/debug/${plugin_name}.wasm
plugin_out = set ${out_dir}/${plugin_name}.wasm
cp ${plugin_in} ${plugin_out}
cd ..
end
'''
[tasks.get-host-triple]
script_runner = "@duckscript"
script = '''
output = exec rustc -v -V
lines = split ${output.stdout} \n
triple = set ""
for line in ${lines}
if starts_with ${line} "host:" && not is_empty ${line}
bits = split ${line} " "
triple = array_get ${bits} 1
triple = set ${triple}
end
end
if not is_empty ${triple}
set_env CARGO_HOST_TRIPLE "${triple}"
end
'''
[tasks.manpage]
workspace = false
description = "Use mandown crate to create or update man entry from docs/MANPAGES.md"
script = '''
root_dir=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}
mkdir -p ${root_dir}/assets/man
mandown ${root_dir}/docs/MANPAGE.md ZELLIJ 1 > ${root_dir}/assets/man/zellij.1
'''
dependencies = ["install-mandown"]
[tasks.install-mandown]
command = "cargo"
args = ["install", "mandown"]
# copy the example default config from assets directory to a more user facing one
[tasks.update-default-config]
workspace = false
dependencies = []
script_runner = "@duckscript"
script = '''
cp ${ZELLIJ_ASSETS_DIR}/config/default.kdl ${ZELLIJ_EXAMPLE_DIR}/default.kdl
'''
# CI Releasing Zellij
[tasks.ci-build-release]
workspace = false
dependencies = [
"plugins-release",
"setup-cross-compilation",
"manpage",
]
command = "cross"
args = [
"build",
"--verbose",
"--release",
"--target",
"${CARGO_MAKE_TASK_ARGS}",
]
# Build e2e asset
[tasks.build-e2e]
workspace = false
dependencies = ["wasm-opt-plugins", "build-e2e-data-dir"]
command = "cargo"
args = [
"build",
"--verbose",
"--release",
"--target",
"x86_64-unknown-linux-musl",
]
# Run e2e tests - we mark the e2e tests as "ignored" so they will not be run with the normal ones
[tasks.e2e-test]
workspace = false
dependencies = ["build-e2e", "plugins"]
command = "cargo"
args = [
"test",
"--",
"--ignored",
"--nocapture",
"--test-threads",
"1",
"@@split(CARGO_MAKE_TASK_ARGS,;)",
]
[tasks.setup-cross-compilation]
command = "cargo"
args = ["install", "cross"]
# Publishing Zellij
[tasks.publish]
clear = true
workspace = false
dependencies = [
"plugins-release",
"update-default-config",
"release-commit",
]
run_task = "publish-zellij"
[tasks.release-commit]
dependencies = ["commit-all", "tag-release"]
command = "git"
args = ["push", "--atomic", "origin", "main", "v${CARGO_MAKE_CRATE_VERSION}"]
[tasks.commit-all]
ignore_errors = true
dependencies = ["plugins-release"]
command = "git"
args = ["commit", "-aem", "chore(release): v${CARGO_MAKE_CRATE_VERSION}"]
[tasks.tag-release]
command = "git"
args = ["tag", "--annotate", "--message", "Version ${CARGO_MAKE_CRATE_VERSION}", "v${CARGO_MAKE_CRATE_VERSION}"]
[tasks.publish-zellij-tile]
ignore_errors = true
dependencies = ["publish-zellij-utils"]
cwd = "zellij-tile"
script = "cargo publish && sleep 15"
[tasks.publish-zellij-client]
ignore_errors = true
dependencies = ["publish-zellij-utils"]
cwd = "zellij-client"
script = "cargo publish && sleep 15"
[tasks.publish-zellij-server]
ignore_errors = true
dependencies = ["publish-zellij-utils"]
cwd = "zellij-server"
script = "cargo publish && sleep 15"
[tasks.publish-zellij-utils]
ignore_errors = true
dependencies = ["publish-zellij-utils"]
cwd = "zellij-utils"
script = "cargo publish && sleep 15"
[tasks.publish-zellij-tile-utils]
ignore_errors = true
cwd = "zellij-tile-utils"
script = "cargo publish && sleep 15"
[tasks.publish-zellij]
dependencies = [
"publish-zellij-utils",
"publish-zellij-tile-utils",
"publish-zellij-tile",
"publish-zellij-client",
"publish-zellij-server",
]
command = "cargo"
args = ["publish"]

View file

@ -1,2 +1,2 @@
[build]
target = "wasm32-wasi"
target = "wasm32-wasip1"

View file

@ -1,2 +1,2 @@
[build]
target = "wasm32-wasi"
target = "wasm32-wasip1"

View file

@ -1,2 +1,2 @@
[build]
target = "wasm32-wasi"
target = "wasm32-wasip1"

View file

@ -1,2 +1,2 @@
[build]
target = "wasm32-wasi"
target = "wasm32-wasip1"

View file

@ -1,2 +1,2 @@
[build]
target = "wasm32-wasi"
target = "wasm32-wasip1"

View file

@ -1,2 +1,2 @@
[build]
target = "wasm32-wasi"
target = "wasm32-wasip1"

View file

@ -1,2 +1,2 @@
[build]
target = "wasm32-wasi"
target = "wasm32-wasip1"

View file

@ -1,2 +1,2 @@
[build]
target = "wasm32-wasi"
target = "wasm32-wasip1"

View file

@ -1,6 +1,7 @@
# This file is updated by `update-toolchain.sh`
[toolchain]
# NOTE: When updating this, modify `rust-version` in `Cargo.toml` accordingly
channel = "1.75.0"
components = ["rustfmt", "clippy", "rust-analysis"]
targets = ["wasm32-wasi", "x86_64-unknown-linux-musl"]
channel = "1.84.0"
components = ["rustfmt", "clippy"]
# NOTE: Change this with care, this is also used by the CI pipeline
targets = ["wasm32-wasip1", "x86_64-unknown-linux-musl"]

View file

@ -211,7 +211,7 @@ plugins {
}
load_plugins {
"file:/usr/src/zellij/wasm32-wasi/release/fixture-plugin-for-tests.wasm" {
"file:/usr/src/zellij/wasm32-wasip1/release/fixture-plugin-for-tests.wasm" {
config_key "config_value"
config_key2 "config_value2"
}

View file

@ -127,7 +127,7 @@ fn move_plugin_to_assets(sh: &Shell, plugin_name: &str) -> anyhow::Result<()> {
std::env::var_os("CARGO_TARGET_DIR")
.unwrap_or(crate::project_root().join("target").into_os_string()),
)
.join("wasm32-wasi")
.join("wasm32-wasip1")
.join("release")
.join(plugin_name)
.with_extension("wasm");

View file

@ -33,7 +33,7 @@ pub fn test(sh: &Shell, flags: flags::Test) -> anyhow::Result<()> {
crate::status(&msg);
println!("{}", msg);
// Override wasm32-wasi target for plugins only
// Override wasm32-wasip1 target for plugins only
let cmd = if crate_name.contains("plugins") {
cmd!(sh, "{cargo} test --target {host_triple} --")
} else {
@ -48,7 +48,7 @@ pub fn test(sh: &Shell, flags: flags::Test) -> anyhow::Result<()> {
}
// Determine the target triple of the host. We explicitly run all tests against the host
// architecture so we can test the plugins, too (they default to wasm32-wasi otherwise).
// architecture so we can test the plugins, too (they default to wasm32-wasip1 otherwise).
pub fn host_target_triple(sh: &Shell) -> anyhow::Result<String> {
let rustc_ver = cmd!(sh, "rustc -vV")
.read()

View file

@ -591,8 +591,6 @@ impl WasmBridge {
task::spawn({
let senders = self.senders.clone();
let running_plugin = running_plugin.clone();
let plugin_id = plugin_id;
let client_id = client_id;
let _s = shutdown_sender.clone();
async move {
let mut running_plugin = running_plugin.lock().unwrap();

View file

@ -339,7 +339,7 @@ pub fn go_to_previous_tab() {
unsafe { host_run_plugin_command() };
}
pub fn report_panic(info: &std::panic::PanicInfo) {
pub fn report_panic(info: &std::panic::PanicHookInfo) {
let panic_payload = if let Some(s) = info.payload().downcast_ref::<&str>() {
format!("{}", s)
} else {

View file

@ -94,7 +94,7 @@ mod not_wasm {
//
// - `zellij-utils/assets/plugins`: When building in release mode OR when the
// `plugins_from_target` feature IS NOT set
// - `zellij-utils/../target/wasm32-wasi/debug`: When building in debug mode AND the
// - `zellij-utils/../target/wasm32-wasip1/debug`: When building in debug mode AND the
// `plugins_from_target` feature IS set
macro_rules! add_plugin {
($assets:expr, $plugin:literal) => {
@ -110,7 +110,7 @@ mod not_wasm {
#[cfg(all(feature = "plugins_from_target", debug_assertions))]
include_bytes!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/../target/wasm32-wasi/debug/",
"/../target/wasm32-wasip1/debug/",
$plugin
))
.to_vec(),

View file

@ -225,8 +225,8 @@ impl FromStr for BareKey {
"tab" => Ok(BareKey::Tab),
"esc" => Ok(BareKey::Esc),
"enter" => Ok(BareKey::Enter),
"capsLock" => Ok(BareKey::CapsLock),
"scrollLock" => Ok(BareKey::ScrollLock),
"capslock" => Ok(BareKey::CapsLock),
"scrolllock" => Ok(BareKey::ScrollLock),
"numlock" => Ok(BareKey::NumLock),
"printscreen" => Ok(BareKey::PrintScreen),
"pause" => Ok(BareKey::Pause),

View file

@ -606,7 +606,7 @@ mod not_wasm {
use super::*;
use crate::channels::{SenderWithContext, ASYNCOPENCALLS, OPENCALLS};
use miette::{Diagnostic, GraphicalReportHandler, GraphicalTheme, Report};
use std::panic::PanicInfo;
use std::panic::PanicHookInfo;
use thiserror::Error as ThisError;
/// The maximum amount of calls an [`ErrorContext`] will keep track
@ -651,7 +651,7 @@ mod not_wasm {
}
/// Custom panic handler/hook. Prints the [`ErrorContext`].
pub fn handle_panic<T>(info: &PanicInfo<'_>, sender: &SenderWithContext<T>)
pub fn handle_panic<T>(info: &PanicHookInfo<'_>, sender: &SenderWithContext<T>)
where
T: ErrorInstruction + Clone,
{

View file

@ -433,7 +433,7 @@ impl RunPlugin {
}
}
#[derive(Debug, Serialize, Deserialize, Clone, Hash, Default, Eq)]
#[derive(Debug, Serialize, Deserialize, Clone, Default, Eq)]
pub struct PluginAlias {
pub name: String,
pub configuration: Option<PluginUserConfiguration>,
@ -443,10 +443,19 @@ pub struct PluginAlias {
impl PartialEq for PluginAlias {
fn eq(&self, other: &Self) -> bool {
// NOTE: Keep this in sync with what the `Hash` trait impl does.
self.name == other.name && self.configuration == other.configuration
}
}
impl std::hash::Hash for PluginAlias {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
// NOTE: Keep this in sync with what the `PartiqlEq` trait impl does.
self.name.hash(state);
self.configuration.hash(state);
}
}
impl PluginAlias {
pub fn new(
name: &str,

View file

@ -10,7 +10,7 @@ use crate::position::Position;
/// Contains the position and size of a [`Pane`], or more generally of any terminal, measured
/// in character rows and columns.
#[derive(Clone, Copy, Default, Debug, Serialize, Deserialize, Hash)]
#[derive(Clone, Copy, Default, Debug, Serialize, Deserialize)]
pub struct PaneGeom {
pub x: usize,
pub y: usize,
@ -24,6 +24,7 @@ pub struct PaneGeom {
impl PartialEq for PaneGeom {
fn eq(&self, other: &Self) -> bool {
// compare all except is_pinned
// NOTE: Keep this in sync with what the `Hash` trait impl does.
self.x == other.x
&& self.y == other.y
&& self.rows == other.rows
@ -32,6 +33,17 @@ impl PartialEq for PaneGeom {
}
}
impl std::hash::Hash for PaneGeom {
fn hash<H: Hasher>(&self, state: &mut H) {
// NOTE: Keep this in sync with what the `PartiqlEq` trait impl does.
self.x.hash(state);
self.y.hash(state);
self.rows.hash(state);
self.cols.hash(state);
self.is_stacked.hash(state);
}
}
impl Eq for PaneGeom {}
#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize, PartialEq, Eq)]