Skip to content

Commit

Permalink
update docs/comments
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanSWard committed Jun 14, 2021
1 parent 494b6df commit 0d75c6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 2 additions & 8 deletions crates/bevy_ecs/src/system/commands/command_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub(crate) struct CommandQueueInner {
// SAFE: All commands [`Command`] implement [`Send`]
unsafe impl Send for CommandQueueInner {}

// SAFE: All commands [`Command`] implement [`Sync`]
// SAFE: `&CommandQueueInner` never gives access to the inner commands.
unsafe impl Sync for CommandQueueInner {}

impl CommandQueueInner {
Expand Down Expand Up @@ -64,13 +64,7 @@ impl CommandQueueInner {
}

/// Invoke each command `func` for each inserted value with `world`
/// and then clears the internal bytes/metas vectors.
///
/// # Warning
///
/// This does not [`drop`] the pushed commands.
/// If the command should be dropped, the initially provided `func`
/// should ensure any necessary cleanup occurs.
/// and then clears the internal bytes/metas command vectors.
pub fn apply(&mut self, world: &mut World) {
let byte_ptr = self.bytes.as_mut_ptr();
for meta in self.metas.iter() {
Expand Down
4 changes: 4 additions & 0 deletions crates/bevy_ecs/src/system/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ use command_queue::CommandQueueInner;
use std::marker::PhantomData;

/// A [`World`] mutation.
//
// NOTE: `CommandQueueInner` is `Send` because `Command` is send.
// If the `Command` trait gets reworked to be non-send, `CommandQueueInner`
// should be reworked.
pub trait Command: Send + Sync + 'static {
fn write(self, world: &mut World);
}
Expand Down

0 comments on commit 0d75c6b

Please sign in to comment.