Skip to content

Commit

Permalink
Document World::try_add_handler
Browse files Browse the repository at this point in the history
  • Loading branch information
AsterixxxGallier committed Aug 23, 2024
1 parent 3985514 commit 395e1ce
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,14 @@ impl World {
Some(unsafe { &mut *col.data().as_ptr().cast::<C>().add(loc.row.0 as usize) })
}

/// Adds a new handler to the world, returns its [`HandlerId`], and sends
/// the [`AddHandler`] event to signal its creation.
///
/// If the handler already exists (as determined by [`Handler::type_id`])
/// then the `HandlerId` of the existing handler is returned and no
/// event is sent.
///
/// Returns an error if the configuration of the handler is invalid.
pub(crate) fn try_add_handler<H: IntoHandler<M>, M>(
&mut self,
handler: H,
Expand Down Expand Up @@ -1205,7 +1213,7 @@ impl Default for World {
}
}

/// Reference to a [`World`] where all methods take `&self` and aliasing rules
/// Reference to a [`World`] where all methods take `self` and aliasing rules
/// are not checked. It is the caller's responsibility to ensure that Rust's
/// aliasing rules are not violated.
#[derive(Clone, Copy, Debug)]
Expand Down

0 comments on commit 395e1ce

Please sign in to comment.