Skip to content

Commit

Permalink
document insert_non_send_resource panics (#6328)
Browse files Browse the repository at this point in the history
Signed-off-by: Lena Milizé <[email protected]>

# Objective

Fixes #6277.

## Solution

Adds `# Panics` section to [`fn insert_non_send_resource`](http://dev-docs.bevyengine.org/bevy/ecs/world/struct.World.html#method.insert_non_send_resource) documentation, which explains that it panics when called from thread other than main thread.
  • Loading branch information
lovelymono committed Oct 21, 2022
1 parent 543465b commit 2cdfb5e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/bevy_ecs/src/world/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,9 @@ impl World {
/// `NonSend` resources cannot be sent across threads,
/// and do not need the `Send + Sync` bounds.
/// Systems with `NonSend` resources are always scheduled on the main thread.
///
/// # Panics
/// Panics if called from a thread other than the main thread.
#[inline]
pub fn insert_non_send_resource<R: 'static>(&mut self, value: R) {
self.validate_non_send_access::<R>();
Expand Down

0 comments on commit 2cdfb5e

Please sign in to comment.