We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
insert_non_send_resource
1 parent 80d6273 commit d52ba79Copy full SHA for d52ba79
crates/bevy_ecs/src/system/commands/mod.rs
@@ -1503,5 +1503,27 @@ mod tests {
1503
1504
assert!(!world.contains_non_send::<MyNonSend>());
1505
}
1506
+
1507
+ #[test]
1508
+ fn is_in_fact_not_being_sent() {
1509
+ use std::thread::{self, ThreadId};
1510
1511
+ let mut world = World::default();
1512
+ let mut queue = CommandQueue::default();
1513
1514
+ thread::scope(|s| {
1515
+ s.spawn(|| {
1516
+ let mut commands = Commands::new(&mut queue, &world);
1517
+ commands.insert_non_send_resource(|| thread::current().id());
1518
+ });
1519
1520
1521
+ queue.apply(&mut world);
1522
1523
+ assert_eq!(
1524
+ *world.non_send_resource::<ThreadId>(),
1525
+ std::thread::current().id()
1526
+ );
1527
+ }
1528
1529
0 commit comments