From f4b659ed02c460bf596b7b47ba4e90b2d77ccf6d Mon Sep 17 00:00:00 2001 From: Nam Se Hyun <3580430+namse@users.noreply.github.com> Date: Thu, 24 Jul 2025 23:31:59 +0900 Subject: [PATCH] Replace crossbeam channel with std::sync::mpsc (#861) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Replace crossbeam channel with std::sync::mpsc - Replace all uses of crossbeam::channel with std::sync::mpsc - Remove crossbeam dependency from all Cargo.toml files - Update documentation to remove crossbeam references - Use std::sync::mpsc::channel() instead of crossbeam::channel::unbounded() Fixes #828 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * Update mod.rs --------- Co-authored-by: Claude --- crates/rapier2d-f64/Cargo.toml | 1 - crates/rapier2d/Cargo.toml | 1 - crates/rapier3d-f64/Cargo.toml | 1 - crates/rapier3d/Cargo.toml | 1 - crates/rapier_testbed2d-f64/Cargo.toml | 1 - crates/rapier_testbed2d/Cargo.toml | 1 - crates/rapier_testbed3d-f64/Cargo.toml | 1 - crates/rapier_testbed3d/Cargo.toml | 1 - src/lib.rs | 1 - src/pipeline/event_handler.rs | 6 +++--- src_testbed/harness/mod.rs | 4 ++-- src_testbed/physics/mod.rs | 2 +- 12 files changed, 6 insertions(+), 15 deletions(-) diff --git a/crates/rapier2d-f64/Cargo.toml b/crates/rapier2d-f64/Cargo.toml index 6e943c7..73e4789 100644 --- a/crates/rapier2d-f64/Cargo.toml +++ b/crates/rapier2d-f64/Cargo.toml @@ -73,7 +73,6 @@ parry2d-f64 = "0.22.0-beta.1" simba = "0.9" approx = "0.5" rayon = { version = "1", optional = true } -crossbeam = "0.8" arrayvec = "0.7" bit-vec = "0.8" rustc-hash = "2" diff --git a/crates/rapier2d/Cargo.toml b/crates/rapier2d/Cargo.toml index a0e694c..9984885 100644 --- a/crates/rapier2d/Cargo.toml +++ b/crates/rapier2d/Cargo.toml @@ -74,7 +74,6 @@ parry2d = "0.22.0-beta.1" simba = "0.9" approx = "0.5" rayon = { version = "1", optional = true } -crossbeam = "0.8" arrayvec = "0.7" bit-vec = "0.8" rustc-hash = "2" diff --git a/crates/rapier3d-f64/Cargo.toml b/crates/rapier3d-f64/Cargo.toml index eb91fd1..0f986fe 100644 --- a/crates/rapier3d-f64/Cargo.toml +++ b/crates/rapier3d-f64/Cargo.toml @@ -76,7 +76,6 @@ parry3d-f64 = "0.22.0-beta.1" simba = "0.9" approx = "0.5" rayon = { version = "1", optional = true } -crossbeam = "0.8" arrayvec = "0.7" bit-vec = "0.8" rustc-hash = "2" diff --git a/crates/rapier3d/Cargo.toml b/crates/rapier3d/Cargo.toml index 8257108..190cdae 100644 --- a/crates/rapier3d/Cargo.toml +++ b/crates/rapier3d/Cargo.toml @@ -78,7 +78,6 @@ parry3d = "0.22.0-beta.1" simba = "0.9" approx = "0.5" rayon = { version = "1", optional = true } -crossbeam = "0.8" arrayvec = "0.7" bit-vec = "0.8" rustc-hash = "2" diff --git a/crates/rapier_testbed2d-f64/Cargo.toml b/crates/rapier_testbed2d-f64/Cargo.toml index d612c9f..0ded168 100644 --- a/crates/rapier_testbed2d-f64/Cargo.toml +++ b/crates/rapier_testbed2d-f64/Cargo.toml @@ -50,7 +50,6 @@ web-time = { version = "1.1" } bitflags = "2" num_cpus = { version = "1", optional = true } wrapped2d = { version = "0.4", optional = true } -crossbeam = "0.8" bincode = "1" Inflector = "0.11" md5 = "0.7" diff --git a/crates/rapier_testbed2d/Cargo.toml b/crates/rapier_testbed2d/Cargo.toml index 66b0c20..7e9c93f 100644 --- a/crates/rapier_testbed2d/Cargo.toml +++ b/crates/rapier_testbed2d/Cargo.toml @@ -50,7 +50,6 @@ web-time = { version = "1.1" } bitflags = "2" num_cpus = { version = "1", optional = true } wrapped2d = { version = "0.4", optional = true } -crossbeam = "0.8" bincode = "1" Inflector = "0.11" md5 = "0.7" diff --git a/crates/rapier_testbed3d-f64/Cargo.toml b/crates/rapier_testbed3d-f64/Cargo.toml index 6e46f20..e791e17 100644 --- a/crates/rapier_testbed3d-f64/Cargo.toml +++ b/crates/rapier_testbed3d-f64/Cargo.toml @@ -51,7 +51,6 @@ rand_pcg = "0.3" web-time = { version = "1.1" } bitflags = "2" num_cpus = { version = "1", optional = true } -crossbeam = "0.8" bincode = "1" md5 = "0.7" Inflector = "0.11" diff --git a/crates/rapier_testbed3d/Cargo.toml b/crates/rapier_testbed3d/Cargo.toml index cc1fcfa..b469b9d 100644 --- a/crates/rapier_testbed3d/Cargo.toml +++ b/crates/rapier_testbed3d/Cargo.toml @@ -52,7 +52,6 @@ glam = { version = "0.27", optional = true } # For Physx num_cpus = { version = "1", optional = true } physx = { version = "0.19", features = ["glam"], optional = true } physx-sys = { version = "0.11", optional = true } -crossbeam = "0.8" bincode = "1" md5 = "0.7" Inflector = "0.11" diff --git a/src/lib.rs b/src/lib.rs index 3b6fdb4..9e7eaba 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,7 +25,6 @@ pub extern crate parry3d as parry; #[cfg(all(feature = "dim3", feature = "f64"))] pub extern crate parry3d_f64 as parry; -pub extern crate crossbeam; pub extern crate nalgebra as na; #[cfg(feature = "serde-serialize")] #[macro_use] diff --git a/src/pipeline/event_handler.rs b/src/pipeline/event_handler.rs index 75761e8..a20d0a7 100644 --- a/src/pipeline/event_handler.rs +++ b/src/pipeline/event_handler.rs @@ -1,7 +1,7 @@ use crate::dynamics::RigidBodySet; use crate::geometry::{ColliderSet, CollisionEvent, ContactForceEvent, ContactPair}; use crate::math::Real; -use crossbeam::channel::Sender; +use std::sync::mpsc::Sender; bitflags::bitflags! { #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] @@ -90,14 +90,14 @@ impl EventHandler for () { } } -/// A collision event handler that collects events into a crossbeam channel. +/// A collision event handler that collects events into a channel. pub struct ChannelEventCollector { collision_event_sender: Sender, contact_force_event_sender: Sender, } impl ChannelEventCollector { - /// Initialize a new collision event handler from crossbeam channel senders. + /// Initialize a new collision event handler from channel senders. pub fn new( collision_event_sender: Sender, contact_force_event_sender: Sender, diff --git a/src_testbed/harness/mod.rs b/src_testbed/harness/mod.rs index 0cdd08b..79b134a 100644 --- a/src_testbed/harness/mod.rs +++ b/src_testbed/harness/mod.rs @@ -118,8 +118,8 @@ type Callbacks = #[allow(dead_code)] impl Harness { pub fn new_empty() -> Self { - let collision_event_channel = crossbeam::channel::unbounded(); - let contact_force_event_channel = crossbeam::channel::unbounded(); + let collision_event_channel = std::sync::mpsc::channel(); + let contact_force_event_channel = std::sync::mpsc::channel(); let event_handler = ChannelEventCollector::new(collision_event_channel.0, contact_force_event_channel.0); let events = PhysicsEvents { diff --git a/src_testbed/physics/mod.rs b/src_testbed/physics/mod.rs index 6a1faa9..3882964 100644 --- a/src_testbed/physics/mod.rs +++ b/src_testbed/physics/mod.rs @@ -1,4 +1,3 @@ -use crossbeam::channel::Receiver; use rapier::dynamics::{ CCDSolver, ImpulseJointSet, IntegrationParameters, IslandManager, MultibodyJointSet, RigidBodySet, @@ -8,6 +7,7 @@ use rapier::geometry::{ }; use rapier::math::{Real, Vector}; use rapier::pipeline::{PhysicsHooks, PhysicsPipeline}; +use std::sync::mpsc::Receiver; pub struct PhysicsSnapshot { timestep_id: usize,