Replace crossbeam channel with std::sync::mpsc (#861)

* 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 <noreply@anthropic.com>

* Update mod.rs

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Nam Se Hyun
2025-07-24 23:31:59 +09:00
committed by GitHub
parent 0f5b4a4d88
commit f4b659ed02
12 changed files with 6 additions and 15 deletions

View File

@@ -73,7 +73,6 @@ parry2d-f64 = "0.22.0-beta.1"
simba = "0.9" simba = "0.9"
approx = "0.5" approx = "0.5"
rayon = { version = "1", optional = true } rayon = { version = "1", optional = true }
crossbeam = "0.8"
arrayvec = "0.7" arrayvec = "0.7"
bit-vec = "0.8" bit-vec = "0.8"
rustc-hash = "2" rustc-hash = "2"

View File

@@ -74,7 +74,6 @@ parry2d = "0.22.0-beta.1"
simba = "0.9" simba = "0.9"
approx = "0.5" approx = "0.5"
rayon = { version = "1", optional = true } rayon = { version = "1", optional = true }
crossbeam = "0.8"
arrayvec = "0.7" arrayvec = "0.7"
bit-vec = "0.8" bit-vec = "0.8"
rustc-hash = "2" rustc-hash = "2"

View File

@@ -76,7 +76,6 @@ parry3d-f64 = "0.22.0-beta.1"
simba = "0.9" simba = "0.9"
approx = "0.5" approx = "0.5"
rayon = { version = "1", optional = true } rayon = { version = "1", optional = true }
crossbeam = "0.8"
arrayvec = "0.7" arrayvec = "0.7"
bit-vec = "0.8" bit-vec = "0.8"
rustc-hash = "2" rustc-hash = "2"

View File

@@ -78,7 +78,6 @@ parry3d = "0.22.0-beta.1"
simba = "0.9" simba = "0.9"
approx = "0.5" approx = "0.5"
rayon = { version = "1", optional = true } rayon = { version = "1", optional = true }
crossbeam = "0.8"
arrayvec = "0.7" arrayvec = "0.7"
bit-vec = "0.8" bit-vec = "0.8"
rustc-hash = "2" rustc-hash = "2"

View File

@@ -50,7 +50,6 @@ web-time = { version = "1.1" }
bitflags = "2" bitflags = "2"
num_cpus = { version = "1", optional = true } num_cpus = { version = "1", optional = true }
wrapped2d = { version = "0.4", optional = true } wrapped2d = { version = "0.4", optional = true }
crossbeam = "0.8"
bincode = "1" bincode = "1"
Inflector = "0.11" Inflector = "0.11"
md5 = "0.7" md5 = "0.7"

View File

@@ -50,7 +50,6 @@ web-time = { version = "1.1" }
bitflags = "2" bitflags = "2"
num_cpus = { version = "1", optional = true } num_cpus = { version = "1", optional = true }
wrapped2d = { version = "0.4", optional = true } wrapped2d = { version = "0.4", optional = true }
crossbeam = "0.8"
bincode = "1" bincode = "1"
Inflector = "0.11" Inflector = "0.11"
md5 = "0.7" md5 = "0.7"

View File

@@ -51,7 +51,6 @@ rand_pcg = "0.3"
web-time = { version = "1.1" } web-time = { version = "1.1" }
bitflags = "2" bitflags = "2"
num_cpus = { version = "1", optional = true } num_cpus = { version = "1", optional = true }
crossbeam = "0.8"
bincode = "1" bincode = "1"
md5 = "0.7" md5 = "0.7"
Inflector = "0.11" Inflector = "0.11"

View File

@@ -52,7 +52,6 @@ glam = { version = "0.27", optional = true } # For Physx
num_cpus = { version = "1", optional = true } num_cpus = { version = "1", optional = true }
physx = { version = "0.19", features = ["glam"], optional = true } physx = { version = "0.19", features = ["glam"], optional = true }
physx-sys = { version = "0.11", optional = true } physx-sys = { version = "0.11", optional = true }
crossbeam = "0.8"
bincode = "1" bincode = "1"
md5 = "0.7" md5 = "0.7"
Inflector = "0.11" Inflector = "0.11"

View File

@@ -25,7 +25,6 @@ pub extern crate parry3d as parry;
#[cfg(all(feature = "dim3", feature = "f64"))] #[cfg(all(feature = "dim3", feature = "f64"))]
pub extern crate parry3d_f64 as parry; pub extern crate parry3d_f64 as parry;
pub extern crate crossbeam;
pub extern crate nalgebra as na; pub extern crate nalgebra as na;
#[cfg(feature = "serde-serialize")] #[cfg(feature = "serde-serialize")]
#[macro_use] #[macro_use]

View File

@@ -1,7 +1,7 @@
use crate::dynamics::RigidBodySet; use crate::dynamics::RigidBodySet;
use crate::geometry::{ColliderSet, CollisionEvent, ContactForceEvent, ContactPair}; use crate::geometry::{ColliderSet, CollisionEvent, ContactForceEvent, ContactPair};
use crate::math::Real; use crate::math::Real;
use crossbeam::channel::Sender; use std::sync::mpsc::Sender;
bitflags::bitflags! { bitflags::bitflags! {
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] #[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 { pub struct ChannelEventCollector {
collision_event_sender: Sender<CollisionEvent>, collision_event_sender: Sender<CollisionEvent>,
contact_force_event_sender: Sender<ContactForceEvent>, contact_force_event_sender: Sender<ContactForceEvent>,
} }
impl ChannelEventCollector { impl ChannelEventCollector {
/// Initialize a new collision event handler from crossbeam channel senders. /// Initialize a new collision event handler from channel senders.
pub fn new( pub fn new(
collision_event_sender: Sender<CollisionEvent>, collision_event_sender: Sender<CollisionEvent>,
contact_force_event_sender: Sender<ContactForceEvent>, contact_force_event_sender: Sender<ContactForceEvent>,

View File

@@ -118,8 +118,8 @@ type Callbacks =
#[allow(dead_code)] #[allow(dead_code)]
impl Harness { impl Harness {
pub fn new_empty() -> Self { pub fn new_empty() -> Self {
let collision_event_channel = crossbeam::channel::unbounded(); let collision_event_channel = std::sync::mpsc::channel();
let contact_force_event_channel = crossbeam::channel::unbounded(); let contact_force_event_channel = std::sync::mpsc::channel();
let event_handler = let event_handler =
ChannelEventCollector::new(collision_event_channel.0, contact_force_event_channel.0); ChannelEventCollector::new(collision_event_channel.0, contact_force_event_channel.0);
let events = PhysicsEvents { let events = PhysicsEvents {

View File

@@ -1,4 +1,3 @@
use crossbeam::channel::Receiver;
use rapier::dynamics::{ use rapier::dynamics::{
CCDSolver, ImpulseJointSet, IntegrationParameters, IslandManager, MultibodyJointSet, CCDSolver, ImpulseJointSet, IntegrationParameters, IslandManager, MultibodyJointSet,
RigidBodySet, RigidBodySet,
@@ -8,6 +7,7 @@ use rapier::geometry::{
}; };
use rapier::math::{Real, Vector}; use rapier::math::{Real, Vector};
use rapier::pipeline::{PhysicsHooks, PhysicsPipeline}; use rapier::pipeline::{PhysicsHooks, PhysicsPipeline};
use std::sync::mpsc::Receiver;
pub struct PhysicsSnapshot { pub struct PhysicsSnapshot {
timestep_id: usize, timestep_id: usize,