get_actor_unchecked

Function get_actor_unchecked 

Source
pub fn get_actor_unchecked<T: Actor>(id: &Ustr) -> ActorRef<T>
Expand description

Returns a guard providing mutable access to the registered actor of type T.

The returned ActorRef holds an Rc to keep the actor alive, preventing use-after-free if the actor is removed from the registry.

§Panics

  • Panics if no actor with the specified id is found in the registry.
  • Panics if the stored actor is not of type T.

§Safety

While this function is not marked unsafe, aliasing constraints apply:

  • Aliasing: The caller should ensure no other mutable references to the same actor exist simultaneously. The callback-based message handling pattern in this codebase requires re-entrant access, which technically violates this invariant.
  • Thread safety: The registry is thread-local; do not send guards across threads.